congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
OneToOne.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
javax.persistence.OneToOne
constructor

Best Java code snippets using javax.persistence.OneToOne.<init> (Showing top 20 results out of 1,755)

Refine searchRefine arrow

  • Id.<init>
  • Entity.<init>
  • Column.<init>
  • Table.<init>
  • JoinColumn.<init>
origin: hibernate/hibernate-orm

/**
 * @author Emmanuel Bernard
 */
@Entity
public class PartyAffiliate {
  @Id
  String partyId;

  @OneToOne(mappedBy="partyAffiliate")
  Party party;

  String affiliateName;
}

origin: hibernate/hibernate-orm

/**
 * @author Emmanuel Bernard
 */
@Entity
public class Trousers {
  @Id
  public Integer id;

  @OneToOne
  @JoinColumn(name = "zip_id")
  public TrousersZip zip;

}

origin: hibernate/hibernate-orm

/**
 * @author Emmanuel Bernard
 */
@Entity
public class ExclusiveDependent {
  @EmbeddedId
  DependentId id;

  @JoinColumn(name = "FK", nullable = false)
  // id attribute mapped by join column default
  @MapsId("empPK")
  // maps empPK attribute of embedded id
  @OneToOne
  Employee emp;
}

origin: hibernate/hibernate-orm

@Entity( name = "Root" )
@Table( name = "ROOT" )
public static class Root {
  @Id
  @GeneratedValue
  public Integer id;
  public String rootName;
  @OneToOne
  public Branch branch;
}
origin: hibernate/hibernate-orm

/**
 * @author Emmanuel Bernard
 */
@Entity
public class TrousersZip {
  @Id
  public Integer id;
  @OneToOne(mappedBy = "zip")
  public Trousers trousers;
}

origin: hibernate/hibernate-orm

/**
 * @author Emmanuel Bernard
 */
@Entity
public class MedicalHistory {
  //all attributes map to relationship: AttributeOverride not allowed
  @EmbeddedId
  PersonId id;

  @MapsId
  @JoinColumns({
      @JoinColumn(name = "FK1", referencedColumnName = "firstName"),
      @JoinColumn(name = "FK2", referencedColumnName = "lastName")
  })
  @OneToOne
  Person patient;
}

origin: hibernate/hibernate-orm

@Entity( name = "Post" )
@Table( name = "POST" )
private static class Post {
  @Id
  @GeneratedValue
  Long id;
  @ManyToMany( cascade = CascadeType.ALL )
  Set<Tag> tags;
  @OneToOne( fetch = FetchType.LAZY, mappedBy = "post", cascade = CascadeType.ALL )
  AdditionalDetails additionalDetails;
}
origin: hibernate/hibernate-orm

@Entity
private static class Customer {
  @Id
  Long id;
  @OneToOne
  User user;
  User getUser() {
    return user;
  }
  void setUser(User newUser) {
    user = newUser;
  }
}
origin: hibernate/hibernate-orm

/**
 * @author Emmanuel Bernard
 */
@Entity
public class MedicalHistory {
  //all attributes map to relationship: AttributeOverride not allowed
  @EmbeddedId
  PersonId id;

  @MapsId
  @JoinColumns({
      @JoinColumn(name = "FK1", referencedColumnName = "firstName"),
      @JoinColumn(name = "FK2", referencedColumnName = "lastName")
  })
  @OneToOne
  Person patient;
}

origin: hibernate/hibernate-orm

  @Entity
  @Table( name = "DataPoint2" )
  public static class DataPoint2 {
    @Id
    @GeneratedValue
    public long id;
    
    @OneToOne
    public DataPoint dp;
    
    @OneToOne
    @org.hibernate.annotations.ForeignKey(name = EXPLICIT_FK_NAME_NATIVE)
    @JoinColumn(name = "explicit_native")
    public DataPoint explicit_native;
    
    @OneToOne
    @JoinColumn(name = "explicit_jpa", foreignKey = @javax.persistence.ForeignKey(name = EXPLICIT_FK_NAME_JPA))
    public DataPoint explicit_jpa;
  }
}
origin: hibernate/hibernate-orm

/**
 * @author Florian Rampp
 * @author Steve Ebersole
 */
@Entity
public class Parent {

  @Id
  Long id;

  @OneToOne(cascade = CascadeType.ALL, mappedBy = "parent")
  Child child;

  void setChild(Child child) {
    this.child = child;
    child.setParent(this);
  }

}

origin: hibernate/hibernate-orm

@javax.persistence.Entity( name = "Parent" )
public static class Parent {
  @Id
  @Column(unique = true, nullable = false)
  private Long id;
  @OneToOne(optional = false, mappedBy = "parent", cascade = ALL)
  private Child child;
  public Long getId() {
    return id;
  }
  public Child getChild() {
    return child;
  }
  public void setChild(Child child) {
    this.child = child;
  }
}
origin: hibernate/hibernate-orm

@Entity
public class Preisregelung {
  @Id
  private Long id;

  @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true)
  private Tranchenmodell tranchenmodell;


  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public Tranchenmodell getTranchenmodell() {
    return tranchenmodell;
  }

  public void setTranchenmodell(Tranchenmodell tranchenmodell) {
    this.tranchenmodell = tranchenmodell;
  }
}

origin: hibernate/hibernate-orm

/**
 * @author Florian Rampp
 * @author Steve Ebersole
 */
@Entity
@Table( name = "CHILD")
public class Child {

  @Id
  // A @OneToOne here results in the following DDL: create table child ([...] primary key
  // (parent), unique (parent)).
  // Oracle does not like a unique constraint and a PK on the same column (results in ORA-02261)
  @OneToOne(optional = false)
  private Parent parent;

  public void setParent(Parent parent) {
    this.parent = parent;
  }

}

origin: hibernate/hibernate-orm

  @Entity(name = "Child")
  public static class Child {
    @Id
    @GeneratedValue
    private Integer id;

    @OneToOne(fetch = FetchType.LAZY)
    private Parent parent;

    public Integer getId() {
      return id;
    }

    public void setParent(Parent parent) {
      this.parent = parent;
    }

    public Parent getParent() {
      return parent;
    }
  }
}
origin: hibernate/hibernate-orm

/**
 * @author Andrea Boriero
 */
@Entity
@Table(name = "USER_SETTING")
public class UserSetting {
  @Id
  @GeneratedValue
  @Column(name = "USER_SETTING_ID")
  public long id;

  @OneToOne
  @JoinColumn(name = "USER_ID", foreignKey = @ForeignKey(name = "FK_TO_USER"))
  private User user;
}

origin: hibernate/hibernate-orm

@Entity(name = "Owner")
public static class Owner {
  @Id
  @GeneratedValue
  private Integer id;
  @OneToOne(cascade = CascadeType.ALL)
  @PrimaryKeyJoinColumn
  private OwnerAddress address;
}
origin: hibernate/hibernate-orm

@javax.persistence.Entity( name = "Child" )
public static class Child {
  @Id
  @Column(unique = true, nullable = false)
  private Long id;
  @OneToOne(optional = false)
  @JoinColumn(nullable = false)
  private Parent parent;
  public Long getId() {
    return id;
  }
  public Parent getParent() {
    return parent;
  }
  public void setParent(Parent parent) {
    this.parent = parent;
  }
}
origin: hibernate/hibernate-orm

/**
 * @author Emmanuel Bernard
 */
@Entity
public class Party {
  @Id
  String partyId;

  @OneToOne(cascade=CascadeType.ALL)
  @PrimaryKeyJoinColumn
  PartyAffiliate partyAffiliate;
}

origin: hibernate/hibernate-orm

  @Entity( name = "AdditionalDetails" )
  @Table( name = "ADDITIONAL_DETAILS" )
  private static class AdditionalDetails {

    @Id
    Long id;

    String details;

    @OneToOne( optional = false )
    @MapsId
    Post post;
  }
}
javax.persistenceOneToOne<init>

Popular methods of OneToOne

  • mappedBy
  • cascade
  • fetch
  • optional
  • targetEntity
  • orphanRemoval

Popular in Java

  • Creating JSON documents from java classes using gson
  • setRequestProperty (URLConnection)
  • onRequestPermissionsResult (Fragment)
  • scheduleAtFixedRate (Timer)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Notification (javax.management)
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now