Examples of GeneratedValue


Examples of javax.persistence.GeneratedValue

          property.isAnnotationPresent( Id.class ) ) {
        //clone classGenerator and override with local values
        Map<String, IdGenerator> localGenerators = new HashMap<String, IdGenerator>();
        localGenerators.putAll( buildLocalGenerators( property, mappings ) );

        GeneratedValue generatedValue = property.getAnnotation( GeneratedValue.class );
        String generatorType = generatedValue != null ? generatorType(
            generatedValue.strategy(), mappings
        ) : "assigned";
        String generator = generatedValue != null ? generatedValue.generator() : BinderHelper.ANNOTATION_STRING_DEFAULT;

        BinderHelper.makeIdGenerator(
            ( SimpleValue ) comp.getProperty( property.getName() ).getValue(),
            generatorType,
            generator,
View Full Code Here

Examples of net.sourceforge.jpaxjc.ns.persistence.orm.GeneratedValue

                        recurseAddId( orm, attr, c.getSuperClass() );
                    }
                    else
                    {
                        final Id id = new Id();
                        final GeneratedValue gv = new GeneratedValue();
                        final Column col = new Column();
                        a.getId().add( id );

                        gv.setStrategy( GenerationType.AUTO );
                        col.setScale( 0 );
                        col.setPrecision( 20 );
                        col.setNullable( false );
                        id.setName( "jpaId" );
                        id.setGeneratedValue( gv );
View Full Code Here

Examples of net.sourceforge.jpaxjc.ns.persistence.orm.GeneratedValue

                        recurseAddId( orm, attr, c.getSuperClass() );
                    }
                    else
                    {
                        final Id id = new Id();
                        final GeneratedValue gv = new GeneratedValue();
                        final Column col = new Column();
                        a.getId().add( id );

                        gv.setStrategy( GenerationType.AUTO );
                        col.setScale( 0 );
                        col.setPrecision( 20 );
                        col.setNullable( false );
                        id.setName( "jpaId" );
                        id.setGeneratedValue( gv );
View Full Code Here

Examples of org.apache.openejb.jee.jpa.GeneratedValue

            // Sun doen't really support generated primary keys, so we need to add them by hand here
            Set<String> generatedPks = new HashSet<String>(Arrays.asList("BasicCmp2", "AOBasicCmp2", "EncCmp2", "Cmp2RmiIiop"));
            EntityMappings cmpMappings = appModule.getCmpMappings();
            for (Entity entity : cmpMappings.getEntity()) {
                if (generatedPks.contains(entity.getName())) {
                    entity.getAttributes().getId().get(0).setGeneratedValue(new GeneratedValue(GenerationType.IDENTITY));
                }
            }
            String actual = toString(cmpMappings);

            XMLUnit.setIgnoreWhitespace(true);
View Full Code Here

Examples of org.apache.openejb.jee.jpa.GeneratedValue

            // Sun doen't really support generated primary keys, so we need to add them by hand here
            Set<String> generatedPks = new HashSet<String>(Arrays.asList("BasicCmp2", "AOBasicCmp2", "EncCmp2", "Cmp2RmiIiop"));
            EntityMappings cmpMappings = appModule.getCmpMappings();
            for (Entity entity : cmpMappings.getEntity()) {
                if (generatedPks.contains(entity.getName())) {
                    entity.getAttributes().getId().get(0).setGeneratedValue(new GeneratedValue(GenerationType.IDENTITY));
                }
            }
            String actual = toString(cmpMappings);
            assertEquals(expected, actual);
        }
View Full Code Here

Examples of org.apache.openejb.jee.jpa.GeneratedValue

                Attributes attributes = entityData.entity.getAttributes();
                if (attributes != null && attributes.getId().size() == 1) {
                    Id id = attributes.getId().get(0);

                    // todo detect specific generation strategy
                    id.setGeneratedValue(new GeneratedValue(GenerationType.IDENTITY));
                }
            }

            for (QueryType query : bean.getQuery()) {
                NamedQuery namedQuery = new NamedQuery();
View Full Code Here

Examples of org.apache.openejb.jee.jpa.GeneratedValue

            mapping.addField(field);
            primaryKeyFields.add(fieldName);
        } else if ("java.lang.Object".equals(bean.getPrimKeyClass())) {
            String fieldName = "OpenEJB_pk";
            Id field = new Id(fieldName);
            field.setGeneratedValue(new GeneratedValue(GenerationType.AUTO));
            mapping.addField(field);
            primaryKeyFields.add(fieldName);
        } else if (bean.getPrimKeyClass() != null) {
            Class<?> pkClass = null;
            try {
View Full Code Here

Examples of org.apache.openejb.jee.jpa.GeneratedValue

            mapping.addField(new AttributeOverride(fieldName));
            primaryKeyFields.add(fieldName);
        } else if ("java.lang.Object".equals(bean.getPrimKeyClass())) {
            String fieldName = "OpenEJB_pk";
            Id field = new Id(fieldName);
            field.setGeneratedValue(new GeneratedValue(GenerationType.AUTO));
            mapping.addField(field);
        } else if (bean.getPrimKeyClass() != null) {
            Class<?> pkClass = null;
            try {
                pkClass = classLoader.loadClass(bean.getPrimKeyClass());
View Full Code Here

Examples of org.apache.openejb.jee.jpa.GeneratedValue

            // Sun doen't really support generated primary keys, so we need to add them by hand here
            Set<String> generatedPks = new HashSet<String>(Arrays.asList("BasicCmp2", "AOBasicCmp2", "EncCmp2", "Cmp2RmiIiop"));
            EntityMappings cmpMappings = appModule.getCmpMappings();
            for (Entity entity : cmpMappings.getEntity()) {
                if (generatedPks.contains(entity.getName())) {
                    entity.getAttributes().getId().get(0).setGeneratedValue(new GeneratedValue(GenerationType.IDENTITY));
                }
            }
            String actual = toString(cmpMappings);

            XMLUnit.setIgnoreWhitespace(true);
View Full Code Here

Examples of org.apache.openejb.jee.jpa.GeneratedValue

                Attributes attributes = entityData.entity.getAttributes();
                if (attributes != null && attributes.getId().size() == 1) {
                    Id id = attributes.getId().get(0);

                    // todo detect specific generation strategy
                    id.setGeneratedValue(new GeneratedValue(GenerationType.IDENTITY));
                }
            }

            for (QueryType query : bean.getQuery()) {
                NamedQuery namedQuery = new NamedQuery();
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.