private static void checkAnyMetaDefValidity(boolean mustHaveName, AnyMetaDef defAnn, XAnnotatedElement annotatedElement) { if ( mustHaveName && isEmptyAnnotationValue( defAnn.name() ) ) { String name = XClass.class.isAssignableFrom( annotatedElement.getClass() ) ? ( (XClass) annotatedElement ).getName() : ( (XPackage) annotatedElement ).getName(); throw new AnnotationException( "@AnyMetaDef.name cannot be null on an entity or a package: " + name ); } }
public void setCache(Cache cacheAnn) { if ( cacheAnn != null ) { cacheRegionName = BinderHelper.isEmptyAnnotationValue( cacheAnn.region() ) ? null : cacheAnn.region(); cacheConcurrencyStrategy = EntityBinder.getCacheConcurrencyStrategy( cacheAnn.usage() ); } else { cacheConcurrencyStrategy = null; cacheRegionName = null; } }
for (Ejb3JoinColumn joinColumn : joinColumns) { final String referencedColumnName = joinColumn.getReferencedColumn(); if ( referencedColumnName == null || BinderHelper.isEmptyAnnotationValue( referencedColumnName ) ) { break;
private void bindEjb3Annotation(Entity ejb3Ann) { if ( ejb3Ann == null ) throw new AssertionFailure( "@Entity should always be not null" ); if ( BinderHelper.isEmptyAnnotationValue( ejb3Ann.name() ) ) { name = StringHelper.unqualify( annotatedClass.getName() ); } else { name = ejb3Ann.name(); } }
private static void bindAnyMetaDef(AnyMetaDef defAnn, MetadataBuildingContext context) { if ( isEmptyAnnotationValue( defAnn.name() ) ) { //don't map not named definitions return; } if ( LOG.isDebugEnabled() ) { LOG.debugf( "Binding Any Meta definition: %s", defAnn.name() ); } context.getMetadataCollector().addAnyMetaDef( defAnn ); }
definitionBuilder.setStrategy( SequenceStyleGenerator.class.getName() ); if ( !BinderHelper.isEmptyAnnotationValue( sequenceGeneratorAnnotation.catalog() ) ) { definitionBuilder.addParam( PersistentIdentifierGenerator.CATALOG, ); if ( !BinderHelper.isEmptyAnnotationValue( sequenceGeneratorAnnotation.schema() ) ) { definitionBuilder.addParam( PersistentIdentifierGenerator.SCHEMA, ); if ( !BinderHelper.isEmptyAnnotationValue( sequenceGeneratorAnnotation.sequenceName() ) ) { definitionBuilder.addParam( SequenceStyleGenerator.SEQUENCE_PARAM,
); if ( !BinderHelper.isEmptyAnnotationValue( table.comment() ) ) hibTable.setComment( table.comment() ); TableBinder.addIndexes( hibTable, table.indexes(), context );
private String getCondition(String cond, String name) { if ( BinderHelper.isEmptyAnnotationValue( cond ) ) { cond = buildingContext.getMetadataCollector().getFilterDefinition( name ).getDefaultFilterCondition(); if ( StringHelper.isEmpty( cond ) ) { throw new AnnotationException( "no filter condition found for filter " + name + " in " + StringHelper.qualify( propertyHolder.getPath(), propertyName ) ); } } return cond; }
definitionBuilder.setStrategy( MultipleHiLoPerTableGenerator.class.getName() ); if ( !BinderHelper.isEmptyAnnotationValue( tableGeneratorAnnotation.table() ) ) { definitionBuilder.addParam( MultipleHiLoPerTableGenerator.ID_TABLE, ); if ( !BinderHelper.isEmptyAnnotationValue( tableGeneratorAnnotation.catalog() ) ) { definitionBuilder.addParam( PersistentIdentifierGenerator.CATALOG, if ( !BinderHelper.isEmptyAnnotationValue( tableGeneratorAnnotation.schema() ) ) { definitionBuilder.addParam( PersistentIdentifierGenerator.SCHEMA, if ( !BinderHelper.isEmptyAnnotationValue( tableGeneratorAnnotation.pkColumnName() ) ) { definitionBuilder.addParam( MultipleHiLoPerTableGenerator.PK_COLUMN_NAME, if ( !BinderHelper.isEmptyAnnotationValue( tableGeneratorAnnotation.valueColumnName() ) ) { definitionBuilder.addParam( MultipleHiLoPerTableGenerator.VALUE_COLUMN_NAME, if ( !BinderHelper.isEmptyAnnotationValue( tableGeneratorAnnotation.pkColumnValue() ) ) { definitionBuilder.addParam( MultipleHiLoPerTableGenerator.PK_VALUE_NAME,
definitionBuilder.addParam( org.hibernate.id.enhanced.TableGenerator.CONFIG_PREFER_SEGMENT_PER_ENTITY, "true" ); if ( !BinderHelper.isEmptyAnnotationValue( tableGeneratorAnnotation.catalog() ) ) { definitionBuilder.addParam( PersistentIdentifierGenerator.CATALOG, tableGeneratorAnnotation.catalog() ); if ( !BinderHelper.isEmptyAnnotationValue( tableGeneratorAnnotation.schema() ) ) { definitionBuilder.addParam( PersistentIdentifierGenerator.SCHEMA, tableGeneratorAnnotation.schema() ); if ( !BinderHelper.isEmptyAnnotationValue( tableGeneratorAnnotation.table() ) ) { definitionBuilder.addParam( org.hibernate.id.enhanced.TableGenerator.TABLE_PARAM, ); if ( !BinderHelper.isEmptyAnnotationValue( tableGeneratorAnnotation.pkColumnName() ) ) { definitionBuilder.addParam( org.hibernate.id.enhanced.TableGenerator.SEGMENT_COLUMN_PARAM, ); if ( !BinderHelper.isEmptyAnnotationValue( tableGeneratorAnnotation.pkColumnValue() ) ) { definitionBuilder.addParam( org.hibernate.id.enhanced.TableGenerator.SEGMENT_VALUE_PARAM, if ( !BinderHelper.isEmptyAnnotationValue( tableGeneratorAnnotation.valueColumnName() ) ) { definitionBuilder.addParam( org.hibernate.id.enhanced.TableGenerator.VALUE_COLUMN_PARAM,
if ( BinderHelper.isEmptyAnnotationValue( defAnn.name() ) && defAnn.defaultForType().equals( void.class ) ) { throw new AnnotationException( "Either name or defaultForType (or both) attribute should be set in TypeDef having typeClass " + if ( !BinderHelper.isEmptyAnnotationValue( defAnn.name() ) ) { if ( LOG.isDebugEnabled() ) { LOG.debugf( typeBindMessageF, defAnn.name() );
@Override @SuppressWarnings("deprecation") public void interpretSequenceGenerator( SequenceGenerator sequenceGeneratorAnnotation, IdentifierGeneratorDefinition.Builder definitionBuilder) { definitionBuilder.setName( sequenceGeneratorAnnotation.name() ); definitionBuilder.setStrategy( "seqhilo" ); if ( !BinderHelper.isEmptyAnnotationValue( sequenceGeneratorAnnotation.sequenceName() ) ) { definitionBuilder.addParam( org.hibernate.id.SequenceGenerator.SEQUENCE, sequenceGeneratorAnnotation.sequenceName() ); } //FIXME: work on initialValue() through SequenceGenerator.PARAMETERS // steve : or just use o.h.id.enhanced.SequenceStyleGenerator if ( sequenceGeneratorAnnotation.initialValue() != 1 ) { log.unsupportedInitialValue( AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS ); } definitionBuilder.addParam( SequenceHiLoGenerator.MAX_LO, String.valueOf( sequenceGeneratorAnnotation.allocationSize() - 1 ) ); } }
public static void bindNamedStoredProcedureQuery( NamedStoredProcedureQuery annotation, MetadataBuildingContext context, boolean isDefault) { if ( annotation == null ) { return; } if ( BinderHelper.isEmptyAnnotationValue( annotation.name() ) ) { throw new AnnotationException( "A named query must have a name when used in class or package level" ); } final NamedProcedureCallDefinition def = new NamedProcedureCallDefinition( annotation ); if (isDefault) { context.getMetadataCollector().addDefaultNamedProcedureCallDefinition( def ); } else { context.getMetadataCollector().addNamedProcedureCallDefinition( def ); } LOG.debugf( "Bound named stored procedure query : %s => %s", def.getRegisteredName(), def.getProcedureName() ); }
if ( BinderHelper.isEmptyAnnotationValue( queryAnn.name() ) ) { throw new AnnotationException( "A named query must have a name when used in class or package level" ); .setCacheable( queryAnn.cacheable() ) .setCacheRegion( BinderHelper.isEmptyAnnotationValue( queryAnn.cacheRegion() ) ? null : queryAnn.cacheRegion() .setCacheMode( getCacheMode( queryAnn.cacheMode() ) ) .setReadOnly( queryAnn.readOnly() ) .setComment( BinderHelper.isEmptyAnnotationValue( queryAnn.comment() ) ? null : queryAnn.comment() ) .setParameterTypes( null ) .createNamedQueryDefinition();
if ( queryAnn == null ) return; if ( BinderHelper.isEmptyAnnotationValue( queryAnn.name() ) ) { throw new AnnotationException( "A named query must have a name when used in class or package level" ); .setCallable( hints.getBoolean( queryName, QueryHints.CALLABLE ) ); if ( !BinderHelper.isEmptyAnnotationValue( resultSetMapping ) ) {
if ( !BinderHelper.isEmptyAnnotationValue( discAnn.columnDefinition() ) ) { discriminatorColumn.setSqlType( discAnn.columnDefinition() ); if ( !BinderHelper.isEmptyAnnotationValue( discAnn.name() ) ) { discriminatorColumn.setLogicalColumnName( discAnn.name() );
if ( !BinderHelper.isEmptyAnnotationValue( annJoin.columnDefinition() ) ) { setSqlType( getBuildingContext().getObjectNameNormalizer().applyGlobalQuoting( annJoin.columnDefinition() ) ); if ( !BinderHelper.isEmptyAnnotationValue( annJoin.name() ) ) { setLogicalColumnName( annJoin.name() ); setReferencedColumn( annJoin.referencedColumnName() ); if ( BinderHelper.isEmptyAnnotationValue( annJoin.table() ) ) { setExplicitTableName( "" );
private void setFKNameIfDefined(Join join) { // just awful.. org.hibernate.annotations.Table matchingTable = findMatchingComplimentTableAnnotation( join ); if ( matchingTable != null && !BinderHelper.isEmptyAnnotationValue( matchingTable.foreignKey().name() ) ) { ( (SimpleValue) join.getKey() ).setForeignKeyName( matchingTable.foreignKey().name() ); } else { javax.persistence.SecondaryTable jpaSecondaryTable = findMatchingSecondaryTable( join ); if ( jpaSecondaryTable != null ) { if ( jpaSecondaryTable.foreignKey().value() == ConstraintMode.NO_CONSTRAINT ) { ( (SimpleValue) join.getKey() ).setForeignKeyName( "none" ); } else { ( (SimpleValue) join.getKey() ).setForeignKeyName( StringHelper.nullIfEmpty( jpaSecondaryTable.foreignKey().name() ) ); ( (SimpleValue) join.getKey() ).setForeignKeyDefinition( StringHelper.nullIfEmpty( jpaSecondaryTable.foreignKey().foreignKeyDefinition() ) ); } } } }
MetadataBuildingContext buildingContext) { if ( ann != null ) { if ( BinderHelper.isEmptyAnnotationValue( mappedBy ) ) { throw new AnnotationException( "Illegal attempt to define a @JoinColumn with a mappedBy association: "
boolean isDefault) { if ( queryAnn == null ) return; if ( BinderHelper.isEmptyAnnotationValue( queryAnn.name() ) ) { throw new AnnotationException( "A named query must have a name when used in class or package level" );