Codota Logo
OneToOne.optional
Code IndexAdd Codota to your IDE (free)

How to use
optional
method
in
javax.persistence.OneToOne

Best Java code snippets using javax.persistence.OneToOne.optional (Showing top 20 results out of 315)

  • 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

ad.setValue( "targetEntity", oneToOne.targetEntity() );
ad.setValue( "fetch", oneToOne.fetch() );
ad.setValue( "optional", oneToOne.optional() );
ad.setValue( "mappedBy", oneToOne.mappedBy() );
ad.setValue( "orphanRemoval", oneToOne.orphanRemoval() );
origin: Impetus/Kundera

Arrays.asList(oneToOneAnn.cascade()), oneToOneAnn.optional(), oneToOneAnn.mappedBy(),
Relation.ForeignKey.ONE_TO_ONE);
origin: toplink.essentials/toplink-essentials

/**
 * INTERNAL:
 */
public boolean isOptional() {
  return (m_oneToOne == null) ? true : m_oneToOne.optional();
}

origin: ebean-orm/ebean

private void readOneToOne(OneToOne propAnn, DeployBeanPropertyAssocOne<?> prop) {
 prop.setOneToOne();
 prop.setDbInsertable(true);
 prop.setDbUpdateable(true);
 prop.setNullable(propAnn.optional());
 prop.setFetchType(propAnn.fetch());
 prop.setMappedBy(propAnn.mappedBy());
 if (!"".equals(propAnn.mappedBy())) {
  prop.setOneToOneExported();
  prop.setOrphanRemoval(propAnn.orphanRemoval());
 } else if (propAnn.orphanRemoval()) {
  prop.setOrphanRemoval(true);
 }
 setCascadeTypes(propAnn.cascade(), prop.getCascadeInfo());
 prop.setBeanTable(beanTable(prop));
}
origin: hibernate/hibernate-orm

!ann.optional() ||
    property.isAnnotationPresent( Id.class ) ||
    ( property.isAnnotationPresent( MapsId.class ) && !ignoreNotFound );
origin: com.haulmont.cuba/cuba-global

protected boolean isMandatory(Field field) {
  OneToMany oneToManyAnnotation = field.getAnnotation(OneToMany.class);
  ManyToMany manyToManyAnnotation = field.getAnnotation(ManyToMany.class);
  if (oneToManyAnnotation != null || manyToManyAnnotation != null) {
    return false;
  }
  Column columnAnnotation = field.getAnnotation(Column.class);
  OneToOne oneToOneAnnotation = field.getAnnotation(OneToOne.class);
  ManyToOne manyToOneAnnotation = field.getAnnotation(ManyToOne.class);
  com.haulmont.chile.core.annotations.MetaProperty metaPropertyAnnotation =
      field.getAnnotation(com.haulmont.chile.core.annotations.MetaProperty.class);
  boolean superMandatory = (metaPropertyAnnotation != null && metaPropertyAnnotation.mandatory())
      || (field.getAnnotation(NotNull.class) != null
        && isDefinedForDefaultValidationGroup(field.getAnnotation(NotNull.class)));  // @NotNull without groups
  return (columnAnnotation != null && !columnAnnotation.nullable())
      || (oneToOneAnnotation != null && !oneToOneAnnotation.optional())
      || (manyToOneAnnotation != null && !manyToOneAnnotation.optional())
      || superMandatory;
}
origin: com.haulmont.cuba/cuba-gui

protected boolean isRequired(MetaProperty metaProperty) {
  if (metaProperty.isMandatory())
    return true;
  ManyToOne many2One = metaProperty.getAnnotatedElement().getAnnotation(ManyToOne.class);
  if (many2One != null && !many2One.optional())
    return true;
  OneToOne one2one = metaProperty.getAnnotatedElement().getAnnotation(OneToOne.class);
  return one2one != null && !one2one.optional();
}
origin: com.caucho/resin

private void introspectOneToOne(OneToOne oneToOne)
{
 Class targetClass = oneToOne.targetEntity();
 if (void.class.equals(targetClass))
  targetClass = _fieldType;
 
 setTargetEntity(targetClass);
 
 setCascadeTypes(oneToOne.cascade());
 setFetch(oneToOne.fetch());
 
 _isOptional = oneToOne.optional();
 _mappedBy = oneToOne.mappedBy();
}

origin: org.hibernate.orm/hibernate-core

ad.setValue( "targetEntity", oneToOne.targetEntity() );
ad.setValue( "fetch", oneToOne.fetch() );
ad.setValue( "optional", oneToOne.optional() );
ad.setValue( "mappedBy", oneToOne.mappedBy() );
ad.setValue( "orphanRemoval", oneToOne.orphanRemoval() );
origin: org.batoo.jpa/batoo-jpa

this.optional = oneToOne.optional();
this.removesOprhans = oneToOne.orphanRemoval();
this.mapsId = this.handleMapsId(member, parsed);
origin: org.avaje/ebean

private void readOneToOne(OneToOne propAnn, DeployBeanPropertyAssocOne<?> prop) {
  prop.setOneToOne(true);
  prop.setDbInsertable(true);
  prop.setDbUpdateable(true);
  prop.setNullable(propAnn.optional());
  prop.setFetchType(propAnn.fetch());
  prop.setMappedBy(propAnn.mappedBy());
  if (!"".equals(propAnn.mappedBy())) {
    prop.setOneToOneExported(true);
  }
  setCascadeTypes(propAnn.cascade(), prop.getCascadeInfo());
  BeanTable assoc = factory.getBeanTable(prop.getPropertyType());
  if (assoc == null) {
    String msg = errorMsgMissingBeanTable(prop.getPropertyType(), prop.getFullBeanName());
    throw new RuntimeException(msg);
  }
  prop.setBeanTable(assoc);
}
origin: org.avaje.ebean/ebean

private void readOneToOne(OneToOne propAnn, DeployBeanPropertyAssocOne<?> prop) {
 prop.setOneToOne();
 prop.setDbInsertable(true);
 prop.setDbUpdateable(true);
 prop.setNullable(propAnn.optional());
 prop.setFetchType(propAnn.fetch());
 prop.setMappedBy(propAnn.mappedBy());
 if (!"".equals(propAnn.mappedBy())) {
  prop.setOneToOneExported();
 }
 setCascadeTypes(propAnn.cascade(), prop.getCascadeInfo());
 BeanTable assoc = factory.getBeanTable(prop.getPropertyType());
 if (assoc == null) {
  String msg = errorMsgMissingBeanTable(prop.getPropertyType(), prop.getFullBeanName());
  throw new RuntimeException(msg);
 }
 prop.setBeanTable(assoc);
}
origin: org.avaje.ebeanorm/avaje-ebeanorm-server

private void readOneToOne(OneToOne propAnn, DeployBeanPropertyAssocOne<?> prop) {
  prop.setOneToOne(true);
  prop.setDbInsertable(true);
  prop.setDbUpdateable(true);
  prop.setNullable(propAnn.optional());
  prop.setFetchType(propAnn.fetch());
  prop.setMappedBy(propAnn.mappedBy());
  if (!"".equals(propAnn.mappedBy())) {
    prop.setOneToOneExported(true);
  }
  setCascadeTypes(propAnn.cascade(), prop.getCascadeInfo());
  BeanTable assoc = factory.getBeanTable(prop.getPropertyType());
  if (assoc == null) {
    String msg = errorMsgMissingBeanTable(prop.getPropertyType(), prop.getFullBeanName());
    throw new RuntimeException(msg);
  }
  prop.setBeanTable(assoc);
}
origin: org.apache.openjpa/com.springsource.org.apache.openjpa

/**
 * Parse @OneToOne.
 */
private void parseOneToOne(FieldMetaData fmd, OneToOne anno) {
  if (!JavaTypes.maybePC(fmd.getValue()))
    throw new MetaDataException(_loc.get("bad-meta-anno", fmd,
      "OneToOne"));
  // don't specifically exclude relation from DFG b/c that will prevent
  // us from even reading the fk when reading from the primary table,
  // which is not what most users will want
  if (anno.fetch() == FetchType.EAGER)
    fmd.setInDefaultFetchGroup(true);
  if (!anno.optional())
    fmd.setNullValue(FieldMetaData.NULL_EXCEPTION);
  if (isMappingOverrideMode() && !StringUtils.isEmpty(anno.mappedBy()))
    fmd.setMappedBy(anno.mappedBy());
  if (anno.targetEntity() != void.class)
    fmd.setTypeOverride(anno.targetEntity());
  setCascades(fmd, anno.cascade());
}
origin: io.ebean/ebean

private void readOneToOne(OneToOne propAnn, DeployBeanPropertyAssocOne<?> prop) {
 prop.setOneToOne();
 prop.setDbInsertable(true);
 prop.setDbUpdateable(true);
 prop.setNullable(propAnn.optional());
 prop.setFetchType(propAnn.fetch());
 prop.setMappedBy(propAnn.mappedBy());
 if (!"".equals(propAnn.mappedBy())) {
  prop.setOneToOneExported();
  prop.setOrphanRemoval(propAnn.orphanRemoval());
 } else if (propAnn.orphanRemoval()) {
  prop.setOrphanRemoval(true);
 }
 setCascadeTypes(propAnn.cascade(), prop.getCascadeInfo());
 prop.setBeanTable(beanTable(prop));
}
origin: org.hibernate/hibernate-annotations

final boolean mandatory = !ann.optional() || forcePersist || trueOneToOne;
origin: org.apache.openejb.patch/openjpa-persistence

/**
 * Parse @OneToOne.
 */
private void parseOneToOne(FieldMetaData fmd, OneToOne anno) {
  if (!JavaTypes.maybePC(fmd.getValue()))
    throw new MetaDataException(_loc.get("bad-meta-anno", fmd,
      "OneToOne"));
  // don't specifically exclude relation from DFG b/c that will prevent
  // us from even reading the fk when reading from the primary table,
  // which is not what most users will want
  if (anno.fetch() == FetchType.EAGER)
    fmd.setInDefaultFetchGroup(true);
  if (!anno.optional())
    fmd.setNullValue(FieldMetaData.NULL_EXCEPTION);
  if (isMappingOverrideMode() && !StringUtils.isEmpty(anno.mappedBy()))
    fmd.setMappedBy(anno.mappedBy());
  if (anno.targetEntity() != void.class)
    fmd.setTypeOverride(anno.targetEntity());
  setCascades(fmd, anno.cascade());
  setOrphanRemoval(fmd, anno.orphanRemoval());
  fmd.setAssociationType(FieldMetaData.ONE_TO_ONE);
}
origin: org.apache.openejb.patch/openjpa

/**
 * Parse @OneToOne.
 */
private void parseOneToOne(FieldMetaData fmd, OneToOne anno) {
  if (!JavaTypes.maybePC(fmd.getValue()))
    throw new MetaDataException(_loc.get("bad-meta-anno", fmd,
      "OneToOne"));
  // don't specifically exclude relation from DFG b/c that will prevent
  // us from even reading the fk when reading from the primary table,
  // which is not what most users will want
  if (anno.fetch() == FetchType.EAGER)
    fmd.setInDefaultFetchGroup(true);
  if (!anno.optional())
    fmd.setNullValue(FieldMetaData.NULL_EXCEPTION);
  if (isMappingOverrideMode() && !StringUtils.isEmpty(anno.mappedBy()))
    fmd.setMappedBy(anno.mappedBy());
  if (anno.targetEntity() != void.class)
    fmd.setTypeOverride(anno.targetEntity());
  setCascades(fmd, anno.cascade());
  setOrphanRemoval(fmd, anno.orphanRemoval());
  fmd.setAssociationType(FieldMetaData.ONE_TO_ONE);
}
origin: org.apache.openjpa/openjpa-all

/**
 * Parse @OneToOne.
 */
private void parseOneToOne(FieldMetaData fmd, OneToOne anno) {
  if (!JavaTypes.maybePC(fmd.getValue()))
    throw new MetaDataException(_loc.get("bad-meta-anno", fmd,
      "OneToOne"));
  // don't specifically exclude relation from DFG b/c that will prevent
  // us from even reading the fk when reading from the primary table,
  // which is not what most users will want
  if (anno.fetch() == FetchType.EAGER)
    fmd.setInDefaultFetchGroup(true);
  if (!anno.optional())
    fmd.setNullValue(FieldMetaData.NULL_EXCEPTION);
  if (isMappingOverrideMode() && !StringUtil.isEmpty(anno.mappedBy()))
    fmd.setMappedBy(anno.mappedBy());
  if (anno.targetEntity() != void.class)
    fmd.setTypeOverride(anno.targetEntity());
  setCascades(fmd, anno.cascade());
  setOrphanRemoval(fmd, anno.orphanRemoval());
  fmd.setAssociationType(FieldMetaData.ONE_TO_ONE);
}
origin: org.apache.openjpa/openjpa-persistence

/**
 * Parse @OneToOne.
 */
private void parseOneToOne(FieldMetaData fmd, OneToOne anno) {
  if (!JavaTypes.maybePC(fmd.getValue()))
    throw new MetaDataException(_loc.get("bad-meta-anno", fmd,
      "OneToOne"));
  // don't specifically exclude relation from DFG b/c that will prevent
  // us from even reading the fk when reading from the primary table,
  // which is not what most users will want
  if (anno.fetch() == FetchType.EAGER)
    fmd.setInDefaultFetchGroup(true);
  if (!anno.optional())
    fmd.setNullValue(FieldMetaData.NULL_EXCEPTION);
  if (isMappingOverrideMode() && !StringUtil.isEmpty(anno.mappedBy()))
    fmd.setMappedBy(anno.mappedBy());
  if (anno.targetEntity() != void.class)
    fmd.setTypeOverride(anno.targetEntity());
  setCascades(fmd, anno.cascade());
  setOrphanRemoval(fmd, anno.orphanRemoval());
  fmd.setAssociationType(FieldMetaData.ONE_TO_ONE);
}
javax.persistenceOneToOneoptional

Popular methods of OneToOne

  • <init>
  • mappedBy
  • cascade
  • fetch
  • targetEntity
  • orphanRemoval

Popular in Java

  • Updating database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • runOnUiThread (Activity)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • TreeMap (java.util)
    A Red-Black tree based NavigableMap implementation. The map is sorted according to the Comparable of
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
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