Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

hibernate onetone with mapsid

@Entity
public class Person {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "person_id")
    private Long id;

    @OneToOne(cascade = CascadeType.ALL)
    @PrimaryKeyJoinColumn
    private VitalStats vitalStats;       
}
Comment

hibernate onetone with mapsid

@Entity
public class VitalStats 
{
    @Id @Column(name="vitalstats_id") Long id;

    @MapsId 
    @OneToOne(mappedBy = "vitalStats")
    @JoinColumn(name = "vitalstats_id")   //same name as id @Column
    private Person person;

    private String stats;
}
Comment

PREVIOUS NEXT
Code Example
Java :: java instanceof operator 
Java :: how to disable coming back to activity android studio 
Java :: java math random 
Java :: stream filter java 8 
Java :: java string loop backwards 
Java :: Create Java Strings using the new keyword 
Java :: java double 
Java :: java stream loop through list 
Java :: java user home directory macos 
Java :: finding the ascii value of a character in java 
Java :: what is java 
Java :: Salary example in method in java 
Java :: android studio checkbox result 
Java :: java infinity 
Java :: look and feel java 
Java :: list interface java 
Java :: what is construct in java 
Java :: meaning of instantiated in java 
Java :: Java Enum compareTo() 
Java :: encryption 
Java :: Java char Keyword 
Java :: java println format 
Java :: Java Abstract Class and Method 
Java :: java heap example 
Java :: save file to disk java 
Java :: androi amterila inpout dialgue to get inouti diaogue 
Java :: Unrolling java - from 
Java :: android java close keyboard 
Java :: What is builder tool 
Java :: sealed class java codegrepper 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =