Package javax.persistence

Examples of javax.persistence.ManyToMany


   * cascade settings.
   */
  public void testCascadeAllPlusMore() throws Exception {
    reader = getReader( Entity2.class, "field1", "many-to-many.orm20.xml" );
    assertAnnotationPresent( ManyToMany.class );
    ManyToMany relAnno = reader.getAnnotation( ManyToMany.class );
    assertEquals( 6, relAnno.cascade().length );
    assertEquals( CascadeType.ALL, relAnno.cascade()[0] );
    assertEquals( CascadeType.PERSIST, relAnno.cascade()[1] );
    assertEquals( CascadeType.MERGE, relAnno.cascade()[2] );
    assertEquals( CascadeType.REMOVE, relAnno.cascade()[3] );
    assertEquals( CascadeType.REFRESH, relAnno.cascade()[4] );
    assertEquals( CascadeType.DETACH, relAnno.cascade()[5] );
  }
View Full Code Here


    assertAnnotationNotPresent( MapKeyColumn.class );
    assertAnnotationNotPresent( MapKeyJoinColumns.class );
    assertAnnotationNotPresent( MapKeyJoinColumn.class );
    assertAnnotationNotPresent( JoinTable.class );
    assertAnnotationPresent( Access.class );
    ManyToMany relAnno = reader.getAnnotation( ManyToMany.class );
    assertEquals( 0, relAnno.cascade().length );
    assertEquals( FetchType.EAGER, relAnno.fetch() );
    assertEquals( "field2", relAnno.mappedBy() );
    assertEquals( Entity3.class, relAnno.targetEntity() );
    assertEquals(
        AccessType.PROPERTY, reader.getAnnotation( Access.class )
        .value()
    );
  }
View Full Code Here

          rel.setToBeanClassName(a.targetEntity().getCanonicalName());
        }

        if (annotations[k].annotationType().equals(javax.persistence.ManyToMany.class))
        {
          ManyToMany a = (ManyToMany) annotations[k];

          if (a.targetEntity().equals(""))
            throw new MissingTargetEntityException(beanName, methods[j].getName());

          rel = new Relationship(beanName);
          rel.setName(methods[j].getName());

          rel.setFromMany(true);
          rel.setToMany(true);
          rel.setToBeanClassName(a.targetEntity().getCanonicalName());
          rel.setMappedBy(a.mappedBy());
        }

        if (annotations[k].annotationType().equals(javax.persistence.OneToOne.class))
        {
          OneToOne a = (OneToOne) annotations[k];

          if (a.targetEntity().equals(""))
            throw new MissingTargetEntityException(beanName, methods[j].getName());

          rel = new Relationship(beanName);
          rel.setName(methods[j].getName());

          rel.setFromMany(false);
          rel.setToMany(false);
          rel.setToBeanClassName(a.targetEntity().getCanonicalName());
          rel.setMappedBy(a.mappedBy());
        }

        /**
         * Annotazioni relative alla generazione !!!!
         *
 
View Full Code Here

          rel.setToBeanClassName(a.targetEntity().getCanonicalName());
        }

        if (annotations[k].annotationType().equals(javax.persistence.ManyToMany.class))
        {
          ManyToMany a = (ManyToMany) annotations[k];

          if (a.targetEntity().equals(""))
            throw new MissingTargetEntityException(beanName, methods[j].getName());

          rel = new Relationship(beanName);
          rel.setName(methods[j].getName());

          rel.setFromMany(true);
          rel.setToMany(true);
          rel.setToBeanClassName(a.targetEntity().getCanonicalName());
          rel.setMappedBy(a.mappedBy());
        }

        if (annotations[k].annotationType().equals(javax.persistence.OneToOne.class))
        {
          OneToOne a = (OneToOne) annotations[k];

          if (a.targetEntity().equals(""))
            throw new MissingTargetEntityException(beanName, methods[j].getName());

          rel = new Relationship(beanName);
          rel.setName(methods[j].getName());

          rel.setFromMany(false);
          rel.setToMany(false);
          rel.setToBeanClassName(a.targetEntity().getCanonicalName());
          rel.setMappedBy(a.mappedBy());
        }
      }

      if (rel != null)
        tmp.add(rel);
View Full Code Here

          // tmp.add(rel);
        }

        if (annotations[k].annotationType().equals(javax.persistence.ManyToMany.class))
        {
          ManyToMany a = (ManyToMany) annotations[k];

          if (a.targetEntity().equals(""))
            throw new MissingTargetEntityException(beanName, methods[j].getName());

          rel = new Relationship(beanName);
          rel.setName(methods[j].getName());

          rel.setFromMany(true);
          rel.setToMany(true);
          rel.setToBeanClassName(a.targetEntity().getCanonicalName());
          rel.setMappedBy(a.mappedBy());

          // tmp.add(rel);
        }

        if (annotations[k].annotationType().equals(javax.persistence.OneToOne.class))
        {
          OneToOne a = (OneToOne) annotations[k];

          if (a.targetEntity().equals(""))
            throw new MissingTargetEntityException(beanName, methods[j].getName());

          rel = new Relationship(beanName);
          rel.setName(methods[j].getName());

          rel.setFromMany(false);
          rel.setToMany(false);
          rel.setToBeanClassName(a.targetEntity().getCanonicalName());
          rel.setMappedBy(a.mappedBy());

          // tmp.add(rel);
        }

        /**
 
View Full Code Here

        OneToMany oneToMany = p.getAnnotation(OneToMany.class);
        if (oneToMany != null) {
            eagerLoad = FetchType.EAGER.equals(oneToMany.fetch());
        }
        if (!eagerLoad) {
            ManyToMany manyToMany = p.getAnnotation(ManyToMany.class);
            if (manyToMany != null) {
                eagerLoad = FetchType.EAGER.equals(manyToMany.fetch());
            }
        }
        Map<Object, Object> generatedCollection = (Map<Object, Object>) Utils.generateMap((Class<?>) p.getType(), null);
        MapLazyLoader handler = new MapLazyLoader(driver, strategy, classLoader, repository, p, objectVertex, generatedCollection, objectsBeingAccessed);
        if (eagerLoad) {
View Full Code Here

        OneToMany oneToMany = p.getAnnotation(OneToMany.class);
        if (oneToMany != null) {
            eagerLoad = FetchType.EAGER.equals(oneToMany.fetch());
        }
        if (!eagerLoad) {
            ManyToMany manyToMany = p.getAnnotation(ManyToMany.class);
            if (manyToMany != null) {
                eagerLoad = FetchType.EAGER.equals(manyToMany.fetch());
            }
        }
        Collection<Object> generatedCollection = Utils.generateCollection((Class<?>) p.getType(), null);
        CollectionLazyLoader handler = new CollectionLazyLoader(driver, strategy, classLoader, repository, p, objectVertex, generatedCollection, objectsBeingAccessed);
        if (eagerLoad) {
View Full Code Here

        OneToMany oneToMany = p.getAnnotation(OneToMany.class);
        if (oneToMany != null) {
            eagerLoad = FetchType.EAGER.equals(oneToMany.fetch());
        }
        if (!eagerLoad) {
            ManyToMany manyToMany = p.getAnnotation(ManyToMany.class);
            if (manyToMany != null) {
                eagerLoad = FetchType.EAGER.equals(manyToMany.fetch());
            }
        }
        Map<Object, Object> generatedCollection = (Map<Object, Object>) Utils.generateMap((Class<?>) p.getType(), null);
        MapLazyLoader handler = new MapLazyLoader(driver, strategy, classLoader, repository, p, objectVertex, generatedCollection, objectsBeingAccessed);
        if (eagerLoad) {
View Full Code Here

        OneToMany oneToMany = p.getAnnotation(OneToMany.class);
        if (oneToMany != null) {
            eagerLoad = FetchType.EAGER.equals(oneToMany.fetch());
        }
        if (!eagerLoad) {
            ManyToMany manyToMany = p.getAnnotation(ManyToMany.class);
            if (manyToMany != null) {
                eagerLoad = FetchType.EAGER.equals(manyToMany.fetch());
            }
        }
        Collection<Object> generatedCollection = Utils.generateCollection((Class<?>) p.getType(), null);
        CollectionLazyLoader handler = new CollectionLazyLoader(driver, strategy, classLoader, repository, p, objectVertex, generatedCollection, objectsBeingAccessed);
        if (eagerLoad) {
View Full Code Here

        OneToMany oneToMany = p.getAnnotation(OneToMany.class);
        if (oneToMany != null) {
            eagerLoad = FetchType.EAGER.equals(oneToMany.fetch());
        }
        if (!eagerLoad) {
            ManyToMany manyToMany = p.getAnnotation(ManyToMany.class);
            if (manyToMany != null) {
                eagerLoad = FetchType.EAGER.equals(manyToMany.fetch());
            }
        }
        Map<Object, Object> generatedCollection = (Map<Object, Object>) Utils.generateMap((Class<?>) p.getType(), null);
        MapLazyLoader handler = new MapLazyLoader(driver, strategy, classLoader, repository, p, objectVertex, generatedCollection, objectsBeingAccessed);
        if (eagerLoad) {
View Full Code Here

TOP

Related Classes of javax.persistence.ManyToMany

Copyright © 2018 www.massapicom. 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.