Package javax.persistence

Examples of javax.persistence.OneToOne.optional()


          //provide the basic property mapping
          boolean optional = true;
          boolean lazy = false;
          if ( property.isAnnotationPresent( Basic.class ) ) {
            Basic ann = property.getAnnotation( Basic.class );
            optional = ann.optional();
            lazy = ann.fetch() == FetchType.LAZY;
          }
          //implicit type will check basic types and Serializable classes
          if ( isId || ( !optional && nullability != Nullability.FORCED_NULL ) ) {
            //force columns to not null
View Full Code Here


            joinColumn.setSecondaryTableName( join.getTable().getName() );
          }
        }
        //MapsId means the columns belong to the pk => not null
        //@PKJC must be constrained
          final boolean mandatory = !ann.optional() || forcePersist || trueOneToOne;
       
        bindOneToOne(
            getCascadeStrategy( ann.cascade(), hibernateCascade, ann.orphanRemoval(), forcePersist ),
            joinColumns,
            !mandatory,
View Full Code Here

          //provide the basic property mapping
          boolean optional = true;
          boolean lazy = false;
          if ( property.isAnnotationPresent( Basic.class ) ) {
            Basic ann = property.getAnnotation( Basic.class );
            optional = ann.optional();
            lazy = ann.fetch() == FetchType.LAZY;
          }
          //implicit type will check basic types and Serializable classes
          if ( isId || ( !optional && nullability != Nullability.FORCED_NULL ) ) {
            //force columns to not null
View Full Code Here

    assertAnnotationNotPresent( Access.class );
    OneToOne relAnno = reader.getAnnotation( OneToOne.class );
    assertEquals( 0, relAnno.cascade().length );
    assertEquals( FetchType.EAGER, relAnno.fetch() );
    assertEquals( "", relAnno.mappedBy() );
    assertTrue( relAnno.optional() );
    assertFalse( relAnno.orphanRemoval() );
    assertEquals( void.class, relAnno.targetEntity() );
  }

  /**
 
View Full Code Here

    assertAnnotationPresent( Access.class );
    OneToOne relAnno = reader.getAnnotation( OneToOne.class );
    assertEquals( 0, relAnno.cascade().length );
    assertEquals( FetchType.LAZY, relAnno.fetch() );
    assertEquals( "field2", relAnno.mappedBy() );
    assertFalse( relAnno.optional() );
    assertTrue( relAnno.orphanRemoval() );
    assertEquals( Entity3.class, relAnno.targetEntity() );
    assertEquals(
        AccessType.PROPERTY, reader.getAnnotation( Access.class )
        .value()
View Full Code Here

            joinColumn.setSecondaryTableName( join.getTable().getName() );
          }
        }
        //MapsId means the columns belong to the pk => not null
        //@PKJC must be constrained
        final boolean mandatory = !ann.optional() || forcePersist || trueOneToOne;
        bindOneToOne(
            getCascadeStrategy( ann.cascade(), hibernateCascade, ann.orphanRemoval(), forcePersist ),
            joinColumns,
            !mandatory,
            getFetchMode( ann.fetch() ),
View Full Code Here

          //provide the basic property mapping
          boolean optional = true;
          boolean lazy = false;
          if ( property.isAnnotationPresent( Basic.class ) ) {
            Basic ann = property.getAnnotation( Basic.class );
            optional = ann.optional();
            lazy = ann.fetch() == FetchType.LAZY;
          }
          //implicit type will check basic types and Serializable classes
          if ( isId || ( !optional && nullability != Nullability.FORCED_NULL ) ) {
            //force columns to not null
View Full Code Here

        }
      }
      bindOneToOne(
          getCascadeStrategy( ann.cascade(), hibernateCascade ),
          joinColumns,
          ann.optional(),
          getFetchMode( ann.fetch() ),
          ignoreNotFound, onDeleteCascade,
          mappings.getReflectionManager().toXClass( ann.targetEntity() ),
          propertyHolder,
          inferredData, ann.mappedBy(), trueOneToOne, isIdentifierMapper, inSecondPass, mappings
View Full Code Here

        //provide the basic property mapping
        boolean optional = true;
        boolean lazy = false;
        if ( property.isAnnotationPresent( Basic.class ) ) {
          Basic ann = property.getAnnotation( Basic.class );
          optional = ann.optional();
          lazy = ann.fetch() == FetchType.LAZY;
        }
        //implicit type will check basic types and Serializable classes
        if ( !optional && nullability != Nullability.FORCED_NULL ) {
          //force columns to not null
View Full Code Here

        }
      }
      bindOneToOne(
          getCascadeStrategy( ann.cascade(), hibernateCascade ),
          joinColumns,
          ann.optional(),
          getFetchMode( ann.fetch() ),
          ignoreNotFound, onDeleteCascade,
          mappings.getReflectionManager().toXClass( ann.targetEntity() ),
          propertyHolder,
          inferredData, ann.mappedBy(), trueOneToOne, isIdentifierMapper, inSecondPass, mappings
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.