Tabnine Logo
OneToOne.mappedBy
Code IndexAdd Tabnine to your IDE (free)

How to use
mappedBy
method
in
javax.persistence.OneToOne

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

origin: hibernate/hibernate-orm

private static String getMappedByFromAnnotation(CtField persistentField) {
  OneToOne oto = PersistentAttributesHelper.getAnnotation( persistentField, OneToOne.class );
  if ( oto != null ) {
    return oto.mappedBy();
  }
  OneToMany otm = PersistentAttributesHelper.getAnnotation( persistentField, OneToMany.class );
  if ( otm != null ) {
    return otm.mappedBy();
  }
  // For @ManyToOne associations, mappedBy must come from the @OneToMany side of the association
  ManyToMany mtm = PersistentAttributesHelper.getAnnotation( persistentField, ManyToMany.class );
  return mtm == null ? "" : mtm.mappedBy();
}
origin: hibernate/hibernate-orm

ad.setValue( "fetch", oneToOne.fetch() );
ad.setValue( "optional", oneToOne.optional() );
ad.setValue( "mappedBy", oneToOne.mappedBy() );
ad.setValue( "orphanRemoval", oneToOne.orphanRemoval() );
origin: hibernate/hibernate-orm

OneToOne oneToOneAnn = property.getAnnotation( OneToOne.class );
String mappedBy = oneToOneAnn != null
    ? oneToOneAnn.mappedBy()
    : null;
joinColumns = Ejb3JoinColumn.buildJoinColumns(
origin: Impetus/Kundera

Arrays.asList(oneToOneAnn.cascade()), oneToOneAnn.optional(), oneToOneAnn.mappedBy(),
Relation.ForeignKey.ONE_TO_ONE);
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: toplink.essentials/toplink-essentials

/**
 * INTERNAL: (Overridden in XMLOneToOneAccessor)
 */
public String getMappedBy() {
  return (m_oneToOne == null) ? "" : m_oneToOne.mappedBy();
}

origin: com.haulmont.cuba/cuba-core

@Override
protected String getMappedBy(Field field) {
  return field.getAnnotation(OneToOne.class).mappedBy();
}
@Override
origin: org.hibernate/hibernate-annotations

Ejb3JoinColumn[] buildDefaultJoinColumnsForXToOne(XProperty property, PropertyData inferredData) {
  Ejb3JoinColumn[] joinColumns;
  JoinTable joinTableAnn = propertyHolder.getJoinTable( property );
  if ( joinTableAnn != null ) {
    joinColumns = Ejb3JoinColumn.buildJoinColumns(
        joinTableAnn.inverseJoinColumns(), null, entityBinder.getSecondaryTables(),
        propertyHolder, inferredData.getPropertyName(), mappings
    );
    if ( StringHelper.isEmpty( joinTableAnn.name() ) ) {
      throw new AnnotationException(
          "JoinTable.name() on a @ToOne association has to be explicit: "
              + BinderHelper.getPath( propertyHolder, inferredData )
      );
    }
  }
  else {
    OneToOne oneToOneAnn = property.getAnnotation( OneToOne.class );
    String mappedBy = oneToOneAnn != null ?
        oneToOneAnn.mappedBy() :
        null;
    joinColumns = Ejb3JoinColumn.buildJoinColumns(
        null,
        mappedBy, entityBinder.getSecondaryTables(),
        propertyHolder, inferredData.getPropertyName(), mappings
    );
  }
  return joinColumns;
}
origin: hibernate/hibernate-orm

propertyHolder,
inferredData,
ann.mappedBy(),
trueOneToOne,
isIdentifierMapper,
origin: pl.edu.icm.sedno/sedno-tools

public static boolean isPersistentGetterOwnerOfRelation(Method getter) {
  if (getter.isAnnotationPresent(ManyToOne.class))
    return true;
  
  if (getter.isAnnotationPresent(Embeddable.class))
    return true;
        OneToMany ann = getter.getAnnotation(OneToMany.class);
  if (ann != null && ann.mappedBy() != null)
    return false;
  OneToOne annO = getter.getAnnotation(OneToOne.class);
  if (annO != null && StringUtils.isEmpty(annO.mappedBy()))
    return true;
  
  throw new RuntimeException("isPersistentGetterOwnerOfRelation("+getter+")? don't konw");
}
 
origin: svili365/mybatis-jpa

public static String getMappedName(Field field) {
 if (field.isAnnotationPresent(OneToOne.class)) {
  OneToOne one = field.getAnnotation(OneToOne.class);
  if (!one.mappedBy().trim().equals("")) {
   return one.mappedBy();
  }
 }
 if (field.isAnnotationPresent(OneToMany.class)) {
  OneToMany one = field.getAnnotation(OneToMany.class);
  if (!one.mappedBy().trim().equals("")) {
   return one.mappedBy();
  }
 }
 return null;
}
origin: br.com.jarch/jarch-utils

public static boolean isOneToOneAndMappedBy(Class<?> classMaster, EntityType<?> entiyType) {
  for (Field field : entiyType.getJavaType().getDeclaredFields()) {
    if (!ReflectionUtils.getGenericClass(field).equals(classMaster)) {
      continue;
    }
    OneToOne oneToOne = field.getAnnotation(OneToOne.class);
    if (oneToOne == null) {
      continue;
    }
    LogUtils.warning("Field = " + field.getName() + " / " + field.getType() + " tem mappedBy " + !oneToOne.mappedBy().isEmpty());
    return !oneToOne.mappedBy().isEmpty();
  }
  return false;
}
origin: br.com.jarch/jarch-util

public static boolean isOneToOneAndMappedBy(Class<?> classMaster, EntityType<?> entiyType) {
  for (Field field : entiyType.getJavaType().getDeclaredFields()) {
    if (!ReflectionUtils.getGenericClass(field).equals(classMaster)) {
      continue;
    }
    OneToOne oneToOne = field.getAnnotation(OneToOne.class);
    if (oneToOne == null) {
      continue;
    }
    LogUtils.warning("Field = " + field.getName() + " / " + field.getType() + " tem mappedBy " + !oneToOne.mappedBy().isEmpty());
    return !oneToOne.mappedBy().isEmpty();
  }
  return false;
}
origin: com.haulmont.cuba/cuba-global

protected String getInverseField(Field field) {
  OneToMany oneToManyAnnotation = field.getAnnotation(OneToMany.class);
  if (oneToManyAnnotation != null)
    return isBlank(oneToManyAnnotation.mappedBy()) ? null : oneToManyAnnotation.mappedBy();
  ManyToMany manyToManyAnnotation = field.getAnnotation(ManyToMany.class);
  if (manyToManyAnnotation != null)
    return isBlank(manyToManyAnnotation.mappedBy()) ? null : manyToManyAnnotation.mappedBy();
  OneToOne oneToOneAnnotation = field.getAnnotation(OneToOne.class);
  if (oneToOneAnnotation != null)
    return isBlank(oneToOneAnnotation.mappedBy()) ? null : oneToOneAnnotation.mappedBy();
  return null;
}
origin: SAP/olingo-jpa-processor-v4

boolean isMapped() {
 if (jpaAttribute.getPersistentAttributeType() == PersistentAttributeType.ONE_TO_ONE) {
  final AnnotatedElement annotatedElement = (AnnotatedElement) jpaAttribute.getJavaMember();
  final OneToOne cardinalityOtO = annotatedElement.getAnnotation(OneToOne.class);
  return cardinalityOtO.mappedBy() != null && !cardinalityOtO.mappedBy().isEmpty() ? true : false;
 }
 if (jpaAttribute.getPersistentAttributeType() == PersistentAttributeType.ONE_TO_MANY) {
  final AnnotatedElement annotatedElement = (AnnotatedElement) jpaAttribute.getJavaMember();
  final OneToMany cardinalityOtM = annotatedElement.getAnnotation(OneToMany.class);
  return cardinalityOtM.mappedBy() != null && !cardinalityOtM.mappedBy().isEmpty() ? true : false;
 }
 return false;
}
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

private static String getMappedByFromAnnotation(CtField persistentField) {
  OneToOne oto = PersistentAttributesHelper.getAnnotation( persistentField, OneToOne.class );
  if ( oto != null ) {
    return oto.mappedBy();
  }
  OneToMany otm = PersistentAttributesHelper.getAnnotation( persistentField, OneToMany.class );
  if ( otm != null ) {
    return otm.mappedBy();
  }
  // For @ManyToOne associations, mappedBy must come from the @OneToMany side of the association
  ManyToMany mtm = PersistentAttributesHelper.getAnnotation( persistentField, ManyToMany.class );
  return mtm == null ? "" : mtm.mappedBy();
}
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: 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));
}
javax.persistenceOneToOnemappedBy

Popular methods of OneToOne

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

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSupportFragmentManager (FragmentActivity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • notifyDataSetChanged (ArrayAdapter)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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