@Entity @Table(name="PRODUCT_IMAGE_DESCRIPTION", schema=SchemaConstant.SALESMANAGER_SCHEMA, uniqueConstraints={ @UniqueConstraint(columnNames={ "PRODUCT_IMAGE_ID", private static final long serialVersionUID = 247514890386076337L; @ManyToOne(targetEntity = ProductImage.class) @JoinColumn(name = "PRODUCT_IMAGE_ID", nullable = false) private ProductImage productImage; @Column(name="ALT_TAG", length=100) private String altTag;
@ManyToOne(optional = false) @JoinColumn(table = "SymbolicLinkMixed") public File getTarget() { return target; }
/** * @author Emmanuel Bernard */ @Entity public class Dependent { @EmbeddedId DependentId id; //@JoinColumn(name="FK") // id attribute mapped by join column default @MapsId("empPK") // maps empPK attribute of embedded id @ManyToOne @JoinColumn(nullable=false) Employee emp; }
/** * @author Emmanuel Bernard */ @Entity public class Dependent { @EmbeddedId DependentId id; @MapsId("empPK") @ManyToOne @JoinColumns( { @JoinColumn(nullable = false), @JoinColumn(nullable = false) }) Employee emp; }
@ManyToOne @JoinColumn(name="user_id", nullable=false) public User getCommenter() { return commenter; }
/** * @author Emmanuel Bernard */ @Entity public class Deal { @Id @GeneratedValue public Integer id; @ManyToOne @JoinColumn(referencedColumnName = "userId") public Customer from; @ManyToOne @JoinColumn(referencedColumnName = "userId") public Customer to; }
@Entity @Table( name = "CHILD" ) private static class Child { @EmbeddedId ChildKey id; @MapsId( "parent" ) @ManyToOne Parent parent; public String getfieldOnChildKeyParent() { // Note that there are two GETFIELD ops here, one on the field 'id' that should be enhanced and another // on the field 'parent' that may be or not (depending if 'extended enhancement' is enabled) // Either way, the field 'parent' on ChildKey should not be confused with the field 'parent' on Child return id.parent; } } }
@ManyToOne @JoinColumn(table = "FileFolderMixed") public Folder getParent() { return parent; }
@Entity(name = "Box") @Table(name = "Box", schema = "PUBLIC", catalog = "DB1") public static class Box { @Id public Integer id; @ManyToOne @JoinColumn public Thing thing1; }
@ManyToOne(fetch = FetchType.LAZY) @JoinColumn @LazyToOne(LazyToOneOption.PROXY) public SimpleEntity getParent() { return parent; }
@Entity public static class E1 { @Id @Column( columnDefinition = "`explicitly quoted`" ) private Integer id; @ManyToOne @JoinColumn( columnDefinition = "`explicitly quoted`" ) private E1 other; }