Codota Logo
OneToOne.<init>
Code IndexAdd Codota 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>
  • Common ways to obtain OneToOne
private void myMethod () {
OneToOne o =
  • Codota IconField field;field.getAnnotation(OneToOne.class)
  • Codota IconXProperty property;property.getAnnotation(OneToOne.class)
  • Codota IconAccessibleObject accessibleObject;accessibleObject.getAnnotation(OneToOne.class)
  • Smart code suggestions by Codota
}
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

  • Updating database using SQL prepared statement
  • compareTo (BigDecimal)
  • runOnUiThread (Activity)
  • onCreateOptionsMenu (Activity)
  • Kernel (java.awt.image)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Socket (java.net)
    Provides a client-side TCP socket.
  • ResourceBundle (java.util)
    Resource bundles contain locale-specific objects. When your program needs a locale-specific resource
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now