Package javax.persistence

Examples of javax.persistence.Column.unique()


                                    null, null, null, null, null, null);
                                Column col = overrides[j].column();
                                // TODO Make inferrals about jdbctype, length etc if the field is 1 char etc
                                fmd.addColumn(new ColumnMetaData(fmd, col.name(), null, null, null, null,
                                    "" + col.length(), "" + col.scale(), "" + col.nullable(), null, null,
                                    "" + col.insertable(), "" + col.updatable(), "" + col.unique()));
                                overriddenFields.add(fmd);
                            }
                        }
                    }
                    else if (annName.equals(JPAAnnotationUtils.ATTRIBUTE_OVERRIDE))
View Full Code Here


                            null, null, null, null, null, null);
                        Column col = (Column)annotationValues.get("column");
                        // TODO Make inferrals about jdbctype, length etc if the field is 1 char etc
                        fmd.addColumn(new ColumnMetaData(fmd, col.name(), null, null, null, null,
                            "" + col.length(), "" + col.scale(), "" + col.nullable(), null, null,
                            "" + col.insertable(), "" + col.updatable(), "" + col.unique()));
                        overriddenFields.add(fmd);
                    }
                    else if (annName.equals(JPAAnnotationUtils.ASSOCIATION_OVERRIDES))
                    {
                        AssociationOverride[] overrides = (AssociationOverride[])annotationValues.get("value");
View Full Code Here

                                colmd.setLength(col.length());
                                colmd.setScale(col.scale());
                                colmd.setAllowsNull(col.nullable());
                                colmd.setInsertable(col.insertable());
                                colmd.setUpdateable(col.updatable());
                                colmd.setUnique(col.unique());
                                fmd.addColumn(colmd);
                                overriddenFields.add(fmd);
                            }
                        }
                    }
View Full Code Here

                        colmd.setLength(col.length());
                        colmd.setScale(col.scale());
                        colmd.setAllowsNull(col.nullable());
                        colmd.setInsertable(col.insertable());
                        colmd.setUpdateable(col.updatable());
                        colmd.setUnique(col.unique());
                        fmd.addColumn(colmd);
                        overriddenFields.add(fmd);
                    }
                    else if (annName.equals(JPAAnnotationUtils.ASSOCIATION_OVERRIDES))
                    {
View Full Code Here

    reader = getReader( Entity3.class, "field1", "element-collection.orm16.xml" );
    assertAnnotationPresent( ElementCollection.class );
    assertAnnotationPresent( Column.class );
    Column column = reader.getAnnotation( Column.class );
    assertEquals( "", column.name() );
    assertFalse( column.unique() );
    assertTrue( column.nullable() );
    assertTrue( column.insertable() );
    assertTrue( column.updatable() );
    assertEquals( "", column.columnDefinition() );
    assertEquals( "", column.table() );
View Full Code Here

    reader = getReader( Entity3.class, "field1", "element-collection.orm17.xml" );
    assertAnnotationPresent( ElementCollection.class );
    assertAnnotationPresent( Column.class );
    Column column = reader.getAnnotation( Column.class );
    assertEquals( "col1", column.name() );
    assertTrue( column.unique() );
    assertFalse( column.nullable() );
    assertFalse( column.insertable() );
    assertFalse( column.updatable() );
    assertEquals( "int", column.columnDefinition() );
    assertEquals( "table1", column.table() );
View Full Code Here

      p.setType(f.getType().getName());
      p.setNotNull("true");
      if (colAnn != null) {
        // int size = colAnn.length();
        p.setNotNull(String.valueOf(colAnn.nullable()));
        p.setUnique(String.valueOf(colAnn.unique()));
      }

      if (ClassUtil.isPojo(f.getType())) {
        OneToOne oneAnn = getter.getAnnotation(OneToOne.class);
        if (oneAnn == null)
View Full Code Here

      if (stringNotEmpty(columnAnnotation.columnDefinition())) {
        config.setColumnDefinition(columnAnnotation.columnDefinition());
      }
      config.setWidth(columnAnnotation.length());
      config.setCanBeNull(columnAnnotation.nullable());
      config.setUnique(columnAnnotation.unique());
    }
    if (basicAnnotation != null) {
      config.setCanBeNull(basicAnnotation.optional());
    }
    if (idAnnotation != null) {
View Full Code Here

        return uniqueColumns;
    }

    private String getFromMethod(Method m) {
        Column constraint = findAnnotation(m, Column.class);
        if (constraint == null || !constraint.unique()) {
            return null;
        }
        if (findAnnotation(m, Id.class) != null) {
            return null;
        }
View Full Code Here

        return methodToProperty(m);
    }

    private String getFromField(Field f) {
        Column constraint = f.getAnnotation(Column.class);
        if (constraint == null || !constraint.unique()) {
            return null;
        }
        if (f.getAnnotation(Id.class) != null) {
            // it's the ID
            return null;
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.