Package javax.persistence

Examples of javax.persistence.OneToMany.mappedBy()


            if ( column.isSecondary() ) {
              throw new NotYetImplementedException( "Collections having FK in secondary table" );
            }
          }
          collectionBinder.setFkJoinColumns( joinColumns );
          mappedBy = oneToManyAnn.mappedBy();
          collectionBinder.setTargetEntity(
              mappings.getReflectionManager().toXClass( oneToManyAnn.targetEntity() )
          );
          collectionBinder.setCascadeStrategy(
              getCascadeStrategy(
View Full Code Here


              EasyMock.expect(joinColumn.referencedColumnName()).andStubReturn("DEMO_ID");
              EasyMock.replay(joinColumn);
              return joinColumn;
            } else {
              OneToMany oneToMany = EasyMock.createMock(OneToMany.class);
              EasyMock.expect(oneToMany.mappedBy()).andStubReturn("demo");
              EasyMock.replay(oneToMany);
              return oneToMany;
            }
          }
View Full Code Here

              EasyMock.expect(joinColumn.referencedColumnName()).andStubReturn("DEMO_ID");
              EasyMock.replay(joinColumn);
              return joinColumn;
            } else {
              OneToMany oneToMany = EasyMock.createMock(OneToMany.class);
              EasyMock.expect(oneToMany.mappedBy()).andStubReturn("demo");
              EasyMock.replay(oneToMany);
              return oneToMany;
            }
          }
View Full Code Here

        currentAssociationEnd1.setMultiplicity(EdmMultiplicity.ONE);
        currentAssociationEnd2.setMultiplicity(EdmMultiplicity.MANY);
        if (annotatedElement != null) {
          OneToMany reln = annotatedElement.getAnnotation(OneToMany.class);
          if (reln != null) {
            mappedBy = reln.mappedBy();
          }
        }
        break;
      case MANY_TO_MANY:
        currentAssociationEnd1.setMultiplicity(EdmMultiplicity.MANY);
View Full Code Here

        currentAssociationEnd1.setMultiplicity(EdmMultiplicity.MANY);
        currentAssociationEnd2.setMultiplicity(EdmMultiplicity.MANY);
        if (annotatedElement != null) {
          ManyToMany reln = annotatedElement.getAnnotation(ManyToMany.class);
          if (reln != null) {
            mappedBy = reln.mappedBy();
          }
        }
        break;
      case MANY_TO_ONE:
        currentAssociationEnd1.setMultiplicity(EdmMultiplicity.MANY);
View Full Code Here

        currentAssociationEnd1.setMultiplicity(EdmMultiplicity.ONE);
        currentAssociationEnd2.setMultiplicity(EdmMultiplicity.ONE);
        if (annotatedElement != null) {
          OneToOne reln = annotatedElement.getAnnotation(OneToOne.class);
          if (reln != null) {
            mappedBy = reln.mappedBy();
          }
        }
        break;
      default:
        break;
View Full Code Here

            if ( column.isSecondary() ) {
              throw new NotYetImplementedException( "Collections having FK in secondary table" );
            }
          }
          collectionBinder.setFkJoinColumns( joinColumns );
          mappedBy = oneToManyAnn.mappedBy();
          collectionBinder.setTargetEntity(
              mappings.getReflectionManager().toXClass( oneToManyAnn.targetEntity() )
          );
          collectionBinder.setCascadeStrategy(
              getCascadeStrategy(
View Full Code Here

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

    assertAnnotationNotPresent( JoinColumn.class );
    assertAnnotationNotPresent( Access.class );
    OneToMany relAnno = reader.getAnnotation( OneToMany.class );
    assertEquals( 0, relAnno.cascade().length );
    assertEquals( FetchType.LAZY, relAnno.fetch() );
    assertEquals( "", relAnno.mappedBy() );
    assertFalse( relAnno.orphanRemoval() );
    assertEquals( void.class, relAnno.targetEntity() );
  }

  public void testOrderBy() throws Exception {
View Full Code Here

          // Rimossa perche' ci sono casi in cui e' necessario avere il MERGE !!!
//            if (cascade.equals(CascadeType.MERGE) || cascade.equals(CascadeType.ALL))
//              throw new EntityCheckWrongMergeException(beanName, relationship.getName());
        }
       
        if (annotation.mappedBy().equals(""))
          throw new EntityCheckMissingMappedByException(beanName, relationship.getName());
       
       
        Field targetFields[] = targetEntity.getDeclaredFields();
       
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.