get rid of things named Ejb3
This commit is contained in:
parent
ef4b2732d3
commit
80b5c1e085
|
@ -42,9 +42,9 @@ import org.jboss.logging.Logger;
|
|||
*
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class Ejb3Column {
|
||||
public class AnnotatedColumn {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Ejb3Column.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, AnnotatedColumn.class.getName());
|
||||
|
||||
private MetadataBuildingContext context;
|
||||
|
||||
|
@ -213,7 +213,7 @@ public class Ejb3Column {
|
|||
this.generatedAs = as;
|
||||
}
|
||||
|
||||
public Ejb3Column() {
|
||||
public AnnotatedColumn() {
|
||||
}
|
||||
|
||||
public void bind() {
|
||||
|
@ -502,7 +502,7 @@ public class Ejb3Column {
|
|||
mappingColumn.setNullable( false );
|
||||
}
|
||||
|
||||
public static Ejb3Column[] buildColumnFromAnnotation(
|
||||
public static AnnotatedColumn[] buildColumnFromAnnotation(
|
||||
jakarta.persistence.Column[] anns,
|
||||
org.hibernate.annotations.Formula formulaAnn,
|
||||
Comment commentAnn,
|
||||
|
@ -523,7 +523,7 @@ public class Ejb3Column {
|
|||
context
|
||||
);
|
||||
}
|
||||
public static Ejb3Column[] buildColumnFromAnnotation(
|
||||
public static AnnotatedColumn[] buildColumnFromAnnotation(
|
||||
jakarta.persistence.Column[] anns,
|
||||
org.hibernate.annotations.Formula formulaAnn,
|
||||
Comment commentAnn,
|
||||
|
@ -533,15 +533,15 @@ public class Ejb3Column {
|
|||
String suffixForDefaultColumnName,
|
||||
Map<String, Join> secondaryTables,
|
||||
MetadataBuildingContext context) {
|
||||
Ejb3Column[] columns;
|
||||
AnnotatedColumn[] columns;
|
||||
if ( formulaAnn != null ) {
|
||||
Ejb3Column formulaColumn = new Ejb3Column();
|
||||
AnnotatedColumn formulaColumn = new AnnotatedColumn();
|
||||
formulaColumn.setFormula( formulaAnn.value() );
|
||||
formulaColumn.setImplicit( false );
|
||||
formulaColumn.setBuildingContext( context );
|
||||
formulaColumn.setPropertyHolder( propertyHolder );
|
||||
formulaColumn.bind();
|
||||
columns = new Ejb3Column[] { formulaColumn };
|
||||
columns = new AnnotatedColumn[] { formulaColumn };
|
||||
}
|
||||
else {
|
||||
jakarta.persistence.Column[] actualCols = anns;
|
||||
|
@ -569,7 +569,7 @@ public class Ejb3Column {
|
|||
}
|
||||
else {
|
||||
final int length = actualCols.length;
|
||||
columns = new Ejb3Column[length];
|
||||
columns = new AnnotatedColumn[length];
|
||||
for (int index = 0; index < length; index++) {
|
||||
|
||||
final ObjectNameNormalizer normalizer = context.getObjectNameNormalizer();
|
||||
|
@ -613,7 +613,7 @@ public class Ejb3Column {
|
|||
.render();
|
||||
}
|
||||
|
||||
Ejb3Column column = new Ejb3Column();
|
||||
AnnotatedColumn column = new AnnotatedColumn();
|
||||
|
||||
column.setImplicit( false );
|
||||
column.setSqlType( sqlType );
|
||||
|
@ -723,7 +723,7 @@ public class Ejb3Column {
|
|||
}
|
||||
}
|
||||
|
||||
private static Ejb3Column[] buildImplicitColumn(
|
||||
private static AnnotatedColumn[] buildImplicitColumn(
|
||||
PropertyData inferredData,
|
||||
String suffixForDefaultColumnName,
|
||||
Map<String, Join> secondaryTables,
|
||||
|
@ -731,8 +731,8 @@ public class Ejb3Column {
|
|||
Comment comment,
|
||||
Nullability nullability,
|
||||
MetadataBuildingContext context) {
|
||||
Ejb3Column column = new Ejb3Column();
|
||||
Ejb3Column[] columns = new Ejb3Column[1];
|
||||
AnnotatedColumn column = new AnnotatedColumn();
|
||||
AnnotatedColumn[] columns = new AnnotatedColumn[1];
|
||||
columns[0] = column;
|
||||
|
||||
if ( comment != null ) {
|
||||
|
@ -767,7 +767,7 @@ public class Ejb3Column {
|
|||
return columns;
|
||||
}
|
||||
|
||||
public static void checkPropertyConsistency(Ejb3Column[] columns, String propertyName) {
|
||||
public static void checkPropertyConsistency(AnnotatedColumn[] columns, String propertyName) {
|
||||
int nbrOfColumns = columns.length;
|
||||
|
||||
if ( nbrOfColumns > 1 ) {
|
|
@ -17,14 +17,14 @@ import org.hibernate.boot.spi.MetadataBuildingContext;
|
|||
*
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class Ejb3DiscriminatorColumn extends Ejb3Column {
|
||||
public class AnnotatedDiscriminatorColumn extends AnnotatedColumn {
|
||||
public static final String DEFAULT_DISCRIMINATOR_COLUMN_NAME = "DTYPE";
|
||||
public static final String DEFAULT_DISCRIMINATOR_TYPE = "string";
|
||||
private static final long DEFAULT_DISCRIMINATOR_LENGTH = 31;
|
||||
|
||||
private String discriminatorTypeName;
|
||||
|
||||
public Ejb3DiscriminatorColumn() {
|
||||
public AnnotatedDiscriminatorColumn() {
|
||||
//discriminator default value
|
||||
super();
|
||||
setLogicalColumnName( DEFAULT_DISCRIMINATOR_COLUMN_NAME );
|
||||
|
@ -41,11 +41,11 @@ public class Ejb3DiscriminatorColumn extends Ejb3Column {
|
|||
this.discriminatorTypeName = discriminatorTypeName;
|
||||
}
|
||||
|
||||
public static Ejb3DiscriminatorColumn buildDiscriminatorColumn(
|
||||
public static AnnotatedDiscriminatorColumn buildDiscriminatorColumn(
|
||||
DiscriminatorType type, DiscriminatorColumn discAnn,
|
||||
DiscriminatorFormula discFormulaAnn,
|
||||
MetadataBuildingContext context) {
|
||||
Ejb3DiscriminatorColumn discriminatorColumn = new Ejb3DiscriminatorColumn();
|
||||
AnnotatedDiscriminatorColumn discriminatorColumn = new AnnotatedDiscriminatorColumn();
|
||||
discriminatorColumn.setBuildingContext( context );
|
||||
discriminatorColumn.setImplicit( true );
|
||||
if ( discFormulaAnn != null ) {
|
|
@ -47,7 +47,7 @@ import org.hibernate.mapping.Value;
|
|||
*
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class Ejb3JoinColumn extends Ejb3Column {
|
||||
public class AnnotatedJoinColumn extends AnnotatedColumn {
|
||||
/**
|
||||
* property name related to this column
|
||||
*/
|
||||
|
@ -89,13 +89,13 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
}
|
||||
|
||||
//Due to @AnnotationOverride overriding rules, I don't want the constructor to be public
|
||||
private Ejb3JoinColumn() {
|
||||
private AnnotatedJoinColumn() {
|
||||
setMappedBy( BinderHelper.ANNOTATION_STRING_DEFAULT );
|
||||
}
|
||||
|
||||
//Due to @AnnotationOverride overriding rules, I don't want the constructor to be public
|
||||
//TODO get rid of it and use setters
|
||||
private Ejb3JoinColumn(
|
||||
private AnnotatedJoinColumn(
|
||||
String sqlType,
|
||||
String name,
|
||||
String comment,
|
||||
|
@ -134,14 +134,14 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
return referencedColumn;
|
||||
}
|
||||
|
||||
public static Ejb3JoinColumn[] buildJoinColumnsOrFormulas(
|
||||
public static AnnotatedJoinColumn[] buildJoinColumnsOrFormulas(
|
||||
JoinColumnOrFormula[] anns,
|
||||
String mappedBy,
|
||||
Map<String, Join> joins,
|
||||
PropertyHolder propertyHolder,
|
||||
String propertyName,
|
||||
MetadataBuildingContext buildingContext) {
|
||||
Ejb3JoinColumn [] joinColumns = new Ejb3JoinColumn[anns.length];
|
||||
AnnotatedJoinColumn[] joinColumns = new AnnotatedJoinColumn[anns.length];
|
||||
for (int i = 0; i < anns.length; i++) {
|
||||
JoinColumnOrFormula join = anns[i];
|
||||
JoinFormula formula = join.formula();
|
||||
|
@ -163,14 +163,14 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
/**
|
||||
* build join formula
|
||||
*/
|
||||
public static Ejb3JoinColumn buildJoinFormula(
|
||||
public static AnnotatedJoinColumn buildJoinFormula(
|
||||
JoinFormula ann,
|
||||
String mappedBy,
|
||||
Map<String, Join> joins,
|
||||
PropertyHolder propertyHolder,
|
||||
String propertyName,
|
||||
MetadataBuildingContext buildingContext) {
|
||||
Ejb3JoinColumn formulaColumn = new Ejb3JoinColumn();
|
||||
AnnotatedJoinColumn formulaColumn = new AnnotatedJoinColumn();
|
||||
formulaColumn.setFormula( ann.value() );
|
||||
formulaColumn.setReferencedColumn(ann.referencedColumnName());
|
||||
formulaColumn.setBuildingContext( buildingContext );
|
||||
|
@ -181,7 +181,7 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
return formulaColumn;
|
||||
}
|
||||
|
||||
public static Ejb3JoinColumn[] buildJoinColumns(
|
||||
public static AnnotatedJoinColumn[] buildJoinColumns(
|
||||
JoinColumn[] anns,
|
||||
Comment comment,
|
||||
String mappedBy,
|
||||
|
@ -194,7 +194,7 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
);
|
||||
}
|
||||
|
||||
public static Ejb3JoinColumn[] buildJoinColumnsWithDefaultColumnSuffix(
|
||||
public static AnnotatedJoinColumn[] buildJoinColumnsWithDefaultColumnSuffix(
|
||||
JoinColumn[] anns,
|
||||
Comment comment,
|
||||
String mappedBy,
|
||||
|
@ -208,7 +208,7 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
);
|
||||
if ( actualColumns == null ) actualColumns = anns;
|
||||
if ( actualColumns == null || actualColumns.length == 0 ) {
|
||||
return new Ejb3JoinColumn[] {
|
||||
return new AnnotatedJoinColumn[] {
|
||||
buildJoinColumn(
|
||||
null,
|
||||
comment,
|
||||
|
@ -223,7 +223,7 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
}
|
||||
else {
|
||||
int size = actualColumns.length;
|
||||
Ejb3JoinColumn[] result = new Ejb3JoinColumn[size];
|
||||
AnnotatedJoinColumn[] result = new AnnotatedJoinColumn[size];
|
||||
for (int index = 0; index < size; index++) {
|
||||
result[index] = buildJoinColumn(
|
||||
actualColumns[index],
|
||||
|
@ -243,7 +243,7 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
/**
|
||||
* build join column for SecondaryTables
|
||||
*/
|
||||
private static Ejb3JoinColumn buildJoinColumn(
|
||||
private static AnnotatedJoinColumn buildJoinColumn(
|
||||
JoinColumn ann,
|
||||
Comment comment,
|
||||
String mappedBy, Map<String, Join> joins,
|
||||
|
@ -258,7 +258,7 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
+ BinderHelper.getRelativePath( propertyHolder, propertyName )
|
||||
);
|
||||
}
|
||||
Ejb3JoinColumn joinColumn = new Ejb3JoinColumn();
|
||||
AnnotatedJoinColumn joinColumn = new AnnotatedJoinColumn();
|
||||
joinColumn.setComment( comment != null ? comment.value() : null );
|
||||
joinColumn.setBuildingContext( buildingContext );
|
||||
joinColumn.setJoinAnnotation( ann, null );
|
||||
|
@ -274,7 +274,7 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
return joinColumn;
|
||||
}
|
||||
else {
|
||||
Ejb3JoinColumn joinColumn = new Ejb3JoinColumn();
|
||||
AnnotatedJoinColumn joinColumn = new AnnotatedJoinColumn();
|
||||
joinColumn.setMappedBy( mappedBy );
|
||||
joinColumn.setJoins( joins );
|
||||
joinColumn.setPropertyHolder( propertyHolder );
|
||||
|
@ -335,7 +335,7 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
/**
|
||||
* Build JoinColumn for a JOINED hierarchy
|
||||
*/
|
||||
public static Ejb3JoinColumn buildJoinColumn(
|
||||
public static AnnotatedJoinColumn buildJoinColumn(
|
||||
PrimaryKeyJoinColumn pkJoinAnn,
|
||||
JoinColumn joinAnn,
|
||||
Value identifier,
|
||||
|
@ -381,7 +381,7 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
else {
|
||||
name = context.getObjectNameNormalizer().normalizeIdentifierQuotingAsString( colName );
|
||||
}
|
||||
return new Ejb3JoinColumn(
|
||||
return new AnnotatedJoinColumn(
|
||||
sqlType,
|
||||
name,
|
||||
null,
|
||||
|
@ -401,7 +401,7 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
}
|
||||
else {
|
||||
defaultName = context.getObjectNameNormalizer().normalizeIdentifierQuotingAsString( defaultName );
|
||||
return new Ejb3JoinColumn(
|
||||
return new AnnotatedJoinColumn(
|
||||
null,
|
||||
defaultName,
|
||||
null,
|
||||
|
@ -439,7 +439,7 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
}
|
||||
|
||||
public static void checkIfJoinColumn(Object columns, PropertyHolder holder, PropertyData property) {
|
||||
if ( !( columns instanceof Ejb3JoinColumn[] ) ) {
|
||||
if ( !( columns instanceof AnnotatedJoinColumn[] ) ) {
|
||||
throw new AnnotationException(
|
||||
"@Column cannot be used on an association property: "
|
||||
+ holder.getEntityName()
|
||||
|
@ -625,7 +625,7 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
|
||||
@Override
|
||||
public MetadataBuildingContext getBuildingContext() {
|
||||
return Ejb3JoinColumn.this.getBuildingContext();
|
||||
return AnnotatedJoinColumn.this.getBuildingContext();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -705,7 +705,7 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
|
||||
@Override
|
||||
public MetadataBuildingContext getBuildingContext() {
|
||||
return Ejb3JoinColumn.this.getBuildingContext();
|
||||
return AnnotatedJoinColumn.this.getBuildingContext();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -731,7 +731,7 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
new ImplicitPrimaryKeyJoinColumnNameSource() {
|
||||
@Override
|
||||
public MetadataBuildingContext getBuildingContext() {
|
||||
return Ejb3JoinColumn.this.getBuildingContext();
|
||||
return AnnotatedJoinColumn.this.getBuildingContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -812,7 +812,7 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
public static final int NON_PK_REFERENCE = 2;
|
||||
|
||||
public static int checkReferencedColumnsType(
|
||||
Ejb3JoinColumn[] columns,
|
||||
AnnotatedJoinColumn[] columns,
|
||||
PersistentClass referencedEntity,
|
||||
MetadataBuildingContext context) {
|
||||
//convenient container to find whether a column is an id one or not
|
||||
|
@ -847,7 +847,7 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
( (PersistentClass) columnOwner ).getTable() :
|
||||
( (Join) columnOwner ).getTable();
|
||||
//check each referenced column
|
||||
for (Ejb3JoinColumn ejb3Column : columns) {
|
||||
for (AnnotatedJoinColumn ejb3Column : columns) {
|
||||
String logicalReferencedColumnName = ejb3Column.getReferencedColumn();
|
||||
if ( StringHelper.isNotEmpty( logicalReferencedColumnName ) ) {
|
||||
String referencedColumnName;
|
||||
|
@ -914,16 +914,16 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
super.redefineColumnName( columnName, null, applyNamingStrategy );
|
||||
}
|
||||
|
||||
public static Ejb3JoinColumn[] buildJoinTableJoinColumns(
|
||||
public static AnnotatedJoinColumn[] buildJoinTableJoinColumns(
|
||||
JoinColumn[] annJoins,
|
||||
Map<String, Join> secondaryTables,
|
||||
PropertyHolder propertyHolder,
|
||||
String propertyName,
|
||||
String mappedBy,
|
||||
MetadataBuildingContext buildingContext) {
|
||||
Ejb3JoinColumn[] joinColumns;
|
||||
AnnotatedJoinColumn[] joinColumns;
|
||||
if ( annJoins == null ) {
|
||||
Ejb3JoinColumn currentJoinColumn = new Ejb3JoinColumn();
|
||||
AnnotatedJoinColumn currentJoinColumn = new AnnotatedJoinColumn();
|
||||
currentJoinColumn.setImplicit( true );
|
||||
currentJoinColumn.setNullable( false ); //I break the spec, but it's for good
|
||||
currentJoinColumn.setPropertyHolder( propertyHolder );
|
||||
|
@ -935,18 +935,18 @@ public class Ejb3JoinColumn extends Ejb3Column {
|
|||
currentJoinColumn.setMappedBy( mappedBy );
|
||||
currentJoinColumn.bind();
|
||||
|
||||
joinColumns = new Ejb3JoinColumn[] {
|
||||
joinColumns = new AnnotatedJoinColumn[] {
|
||||
currentJoinColumn
|
||||
|
||||
};
|
||||
}
|
||||
else {
|
||||
joinColumns = new Ejb3JoinColumn[annJoins.length];
|
||||
joinColumns = new AnnotatedJoinColumn[annJoins.length];
|
||||
JoinColumn annJoin;
|
||||
int length = annJoins.length;
|
||||
for (int index = 0; index < length; index++) {
|
||||
annJoin = annJoins[index];
|
||||
Ejb3JoinColumn currentJoinColumn = new Ejb3JoinColumn();
|
||||
AnnotatedJoinColumn currentJoinColumn = new AnnotatedJoinColumn();
|
||||
currentJoinColumn.setImplicit( true );
|
||||
currentJoinColumn.setPropertyHolder( propertyHolder );
|
||||
currentJoinColumn.setJoins( secondaryTables );
|
|
@ -601,14 +601,14 @@ public final class AnnotationBinder {
|
|||
uniqueConstraints = TableBinder.buildUniqueConstraintHolders( tabAnn.uniqueConstraints() );
|
||||
}
|
||||
|
||||
Ejb3JoinColumn[] inheritanceJoinedColumns = makeInheritanceJoinColumns(
|
||||
AnnotatedJoinColumn[] inheritanceJoinedColumns = makeInheritanceJoinColumns(
|
||||
clazzToProcess,
|
||||
context,
|
||||
inheritanceState,
|
||||
superEntity
|
||||
);
|
||||
|
||||
final Ejb3DiscriminatorColumn discriminatorColumn;
|
||||
final AnnotatedDiscriminatorColumn discriminatorColumn;
|
||||
if ( InheritanceType.SINGLE_TABLE.equals( inheritanceState.getType() ) ) {
|
||||
discriminatorColumn = processSingleTableDiscriminatorProperties(
|
||||
clazzToProcess,
|
||||
|
@ -940,14 +940,14 @@ public final class AnnotationBinder {
|
|||
/**
|
||||
* Process all discriminator-related metadata per rules for "single table" inheritance
|
||||
*/
|
||||
private static Ejb3DiscriminatorColumn processSingleTableDiscriminatorProperties(
|
||||
private static AnnotatedDiscriminatorColumn processSingleTableDiscriminatorProperties(
|
||||
XClass clazzToProcess,
|
||||
MetadataBuildingContext context,
|
||||
InheritanceState inheritanceState,
|
||||
EntityBinder entityBinder) {
|
||||
final boolean isRoot = !inheritanceState.hasParents();
|
||||
|
||||
Ejb3DiscriminatorColumn discriminatorColumn = null;
|
||||
AnnotatedDiscriminatorColumn discriminatorColumn = null;
|
||||
jakarta.persistence.DiscriminatorColumn discAnn = clazzToProcess.getAnnotation(
|
||||
jakarta.persistence.DiscriminatorColumn.class
|
||||
);
|
||||
|
@ -959,7 +959,7 @@ public final class AnnotationBinder {
|
|||
DiscriminatorFormula.class
|
||||
);
|
||||
if ( isRoot ) {
|
||||
discriminatorColumn = Ejb3DiscriminatorColumn.buildDiscriminatorColumn(
|
||||
discriminatorColumn = AnnotatedDiscriminatorColumn.buildDiscriminatorColumn(
|
||||
discriminatorType,
|
||||
discAnn,
|
||||
discFormulaAnn,
|
||||
|
@ -987,7 +987,7 @@ public final class AnnotationBinder {
|
|||
/**
|
||||
* Process all discriminator-related metadata per rules for "joined" inheritance
|
||||
*/
|
||||
private static Ejb3DiscriminatorColumn processJoinedDiscriminatorProperties(
|
||||
private static AnnotatedDiscriminatorColumn processJoinedDiscriminatorProperties(
|
||||
XClass clazzToProcess,
|
||||
MetadataBuildingContext context,
|
||||
InheritanceState inheritanceState,
|
||||
|
@ -1042,7 +1042,7 @@ public final class AnnotationBinder {
|
|||
final DiscriminatorType discriminatorType = discriminatorColumnAnnotation != null
|
||||
? discriminatorColumnAnnotation.discriminatorType()
|
||||
: DiscriminatorType.STRING;
|
||||
return Ejb3DiscriminatorColumn.buildDiscriminatorColumn(
|
||||
return AnnotatedDiscriminatorColumn.buildDiscriminatorColumn(
|
||||
discriminatorType,
|
||||
discriminatorColumnAnnotation,
|
||||
null,
|
||||
|
@ -1302,12 +1302,12 @@ public final class AnnotationBinder {
|
|||
}
|
||||
}
|
||||
|
||||
private static Ejb3JoinColumn[] makeInheritanceJoinColumns(
|
||||
private static AnnotatedJoinColumn[] makeInheritanceJoinColumns(
|
||||
XClass clazzToProcess,
|
||||
MetadataBuildingContext context,
|
||||
InheritanceState inheritanceState,
|
||||
PersistentClass superEntity) {
|
||||
Ejb3JoinColumn[] inheritanceJoinedColumns = null;
|
||||
AnnotatedJoinColumn[] inheritanceJoinedColumns = null;
|
||||
final boolean hasJoinedColumns = inheritanceState.hasParents()
|
||||
&& InheritanceType.JOINED.equals( inheritanceState.getType() );
|
||||
if ( hasJoinedColumns ) {
|
||||
|
@ -1317,10 +1317,10 @@ public final class AnnotationBinder {
|
|||
if ( explicitInheritanceJoinedColumns ) {
|
||||
int nbrOfInhJoinedColumns = jcsAnn.value().length;
|
||||
PrimaryKeyJoinColumn jcAnn;
|
||||
inheritanceJoinedColumns = new Ejb3JoinColumn[nbrOfInhJoinedColumns];
|
||||
inheritanceJoinedColumns = new AnnotatedJoinColumn[nbrOfInhJoinedColumns];
|
||||
for ( int colIndex = 0; colIndex < nbrOfInhJoinedColumns; colIndex++ ) {
|
||||
jcAnn = jcsAnn.value()[colIndex];
|
||||
inheritanceJoinedColumns[colIndex] = Ejb3JoinColumn.buildJoinColumn(
|
||||
inheritanceJoinedColumns[colIndex] = AnnotatedJoinColumn.buildJoinColumn(
|
||||
jcAnn,
|
||||
null,
|
||||
superEntity.getIdentifier(),
|
||||
|
@ -1332,8 +1332,8 @@ public final class AnnotationBinder {
|
|||
}
|
||||
else {
|
||||
PrimaryKeyJoinColumn jcAnn = clazzToProcess.getAnnotation( PrimaryKeyJoinColumn.class );
|
||||
inheritanceJoinedColumns = new Ejb3JoinColumn[1];
|
||||
inheritanceJoinedColumns[0] = Ejb3JoinColumn.buildJoinColumn(
|
||||
inheritanceJoinedColumns = new AnnotatedJoinColumn[1];
|
||||
inheritanceJoinedColumns[0] = AnnotatedJoinColumn.buildJoinColumn(
|
||||
jcAnn,
|
||||
null,
|
||||
superEntity.getIdentifier(),
|
||||
|
@ -1537,7 +1537,7 @@ public final class AnnotationBinder {
|
|||
|
||||
private static void bindDiscriminatorColumnToRootPersistentClass(
|
||||
RootClass rootClass,
|
||||
Ejb3DiscriminatorColumn discriminatorColumn,
|
||||
AnnotatedDiscriminatorColumn discriminatorColumn,
|
||||
Map<String, Join> secondaryTables,
|
||||
PropertyHolder propertyHolder,
|
||||
MetadataBuildingContext context) {
|
||||
|
@ -1754,8 +1754,8 @@ public final class AnnotationBinder {
|
|||
entityBinder,
|
||||
context
|
||||
).extractMetadata();
|
||||
Ejb3Column[] columns = columnsBuilder.getColumns();
|
||||
Ejb3JoinColumn[] joinColumns = columnsBuilder.getJoinColumns();
|
||||
AnnotatedColumn[] columns = columnsBuilder.getColumns();
|
||||
AnnotatedJoinColumn[] joinColumns = columnsBuilder.getJoinColumns();
|
||||
|
||||
final XClass returnedClass = inferredData.getClassOrElement();
|
||||
|
||||
|
@ -1859,7 +1859,7 @@ public final class AnnotationBinder {
|
|||
JoinTable assocTable = propertyHolder.getJoinTable( property );
|
||||
if ( assocTable != null ) {
|
||||
Join join = propertyHolder.addJoin( assocTable, false );
|
||||
for ( Ejb3JoinColumn joinColumn : joinColumns ) {
|
||||
for ( AnnotatedJoinColumn joinColumn : joinColumns ) {
|
||||
joinColumn.setExplicitTableName( join.getTable().getName() );
|
||||
}
|
||||
}
|
||||
|
@ -1925,7 +1925,7 @@ public final class AnnotationBinder {
|
|||
JoinTable assocTable = propertyHolder.getJoinTable( property );
|
||||
if ( assocTable != null ) {
|
||||
Join join = propertyHolder.addJoin( assocTable, false );
|
||||
for ( Ejb3JoinColumn joinColumn : joinColumns ) {
|
||||
for ( AnnotatedJoinColumn joinColumn : joinColumns ) {
|
||||
joinColumn.setExplicitTableName( join.getTable().getName() );
|
||||
}
|
||||
}
|
||||
|
@ -1966,7 +1966,7 @@ public final class AnnotationBinder {
|
|||
JoinTable assocTable = propertyHolder.getJoinTable( property );
|
||||
if ( assocTable != null ) {
|
||||
Join join = propertyHolder.addJoin( assocTable, false );
|
||||
for ( Ejb3JoinColumn joinColumn : joinColumns ) {
|
||||
for ( AnnotatedJoinColumn joinColumn : joinColumns ) {
|
||||
joinColumn.setExplicitTableName( join.getTable().getName() );
|
||||
}
|
||||
}
|
||||
|
@ -2050,7 +2050,7 @@ public final class AnnotationBinder {
|
|||
collectionBinder.setCollectionType( inferredData.getProperty().getElementClass() );
|
||||
collectionBinder.setAccessType( inferredData.getDefaultAccess() );
|
||||
|
||||
Ejb3Column[] elementColumns;
|
||||
AnnotatedColumn[] elementColumns;
|
||||
//do not use "element" if you are a JPA 2 @ElementCollection only for legacy Hibernate mappings
|
||||
boolean isJPA2ForValueMapping = property.isAnnotationPresent( ElementCollection.class );
|
||||
PropertyData virtualProperty = isJPA2ForValueMapping ? inferredData : new WrappedInferredData(
|
||||
|
@ -2061,7 +2061,7 @@ public final class AnnotationBinder {
|
|||
) ) {
|
||||
Column ann = property.getAnnotation( Column.class );
|
||||
Formula formulaAnn = property.getAnnotation( Formula.class );
|
||||
elementColumns = Ejb3Column.buildColumnFromAnnotation(
|
||||
elementColumns = AnnotatedColumn.buildColumnFromAnnotation(
|
||||
new Column[] { ann },
|
||||
formulaAnn,
|
||||
property.getAnnotation( Comment.class ),
|
||||
|
@ -2074,7 +2074,7 @@ public final class AnnotationBinder {
|
|||
}
|
||||
else if ( property.isAnnotationPresent( Columns.class ) ) {
|
||||
Columns anns = property.getAnnotation( Columns.class );
|
||||
elementColumns = Ejb3Column.buildColumnFromAnnotation(
|
||||
elementColumns = AnnotatedColumn.buildColumnFromAnnotation(
|
||||
anns.columns(),
|
||||
null,
|
||||
property.getAnnotation( Comment.class ),
|
||||
|
@ -2086,7 +2086,7 @@ public final class AnnotationBinder {
|
|||
);
|
||||
}
|
||||
else {
|
||||
elementColumns = Ejb3Column.buildColumnFromAnnotation(
|
||||
elementColumns = AnnotatedColumn.buildColumnFromAnnotation(
|
||||
null,
|
||||
null,
|
||||
property.getAnnotation( Comment.class ),
|
||||
|
@ -2106,7 +2106,7 @@ public final class AnnotationBinder {
|
|||
keyColumns = null;
|
||||
}
|
||||
|
||||
Ejb3Column[] mapColumns = Ejb3Column.buildColumnFromAnnotation(
|
||||
AnnotatedColumn[] mapColumns = AnnotatedColumn.buildColumnFromAnnotation(
|
||||
keyColumns,
|
||||
null,
|
||||
property.getAnnotation( Comment.class ),
|
||||
|
@ -2147,7 +2147,7 @@ public final class AnnotationBinder {
|
|||
};
|
||||
}
|
||||
|
||||
Ejb3JoinColumn[] mapJoinColumns = Ejb3JoinColumn.buildJoinColumnsWithDefaultColumnSuffix(
|
||||
AnnotatedJoinColumn[] mapJoinColumns = AnnotatedJoinColumn.buildJoinColumnsWithDefaultColumnSuffix(
|
||||
joinKeyColumns,
|
||||
property.getAnnotation( Comment.class ),
|
||||
null,
|
||||
|
@ -2174,7 +2174,7 @@ public final class AnnotationBinder {
|
|||
}
|
||||
String mappedBy = null;
|
||||
if ( oneToManyAnn != null ) {
|
||||
for ( Ejb3JoinColumn column : joinColumns ) {
|
||||
for ( AnnotatedJoinColumn column : joinColumns ) {
|
||||
if ( column.isSecondary() ) {
|
||||
throw new NotYetImplementedException( "Collections having FK in secondary table" );
|
||||
}
|
||||
|
@ -2192,7 +2192,7 @@ public final class AnnotationBinder {
|
|||
collectionBinder.setOneToMany( true );
|
||||
}
|
||||
else if ( elementCollectionAnn != null ) {
|
||||
for ( Ejb3JoinColumn column : joinColumns ) {
|
||||
for ( AnnotatedJoinColumn column : joinColumns ) {
|
||||
if ( column.isSecondary() ) {
|
||||
throw new NotYetImplementedException( "Collections having FK in secondary table" );
|
||||
}
|
||||
|
@ -2318,7 +2318,7 @@ public final class AnnotationBinder {
|
|||
inheritanceStatePerClass,
|
||||
referencedEntityName,
|
||||
customInstantiatorImpl,
|
||||
isOverridden ? ( Ejb3JoinColumn[] ) columns : null
|
||||
isOverridden ? ( AnnotatedJoinColumn[] ) columns : null
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
@ -2333,7 +2333,7 @@ public final class AnnotationBinder {
|
|||
//implicit type will check basic types and Serializable classes
|
||||
if ( isId || ( !optional && nullability != Nullability.FORCED_NULL ) ) {
|
||||
//force columns to not null
|
||||
for ( Ejb3Column col : columns ) {
|
||||
for ( AnnotatedColumn col : columns ) {
|
||||
if ( isId && col.isFormula() ) {
|
||||
throw new CannotForceNonNullableException(
|
||||
String.format(
|
||||
|
@ -2418,13 +2418,13 @@ public final class AnnotationBinder {
|
|||
if ( index != null ) {
|
||||
if ( joinColumns != null ) {
|
||||
|
||||
for ( Ejb3Column column : joinColumns ) {
|
||||
for ( AnnotatedColumn column : joinColumns ) {
|
||||
column.addIndex( index, inSecondPass );
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( columns != null ) {
|
||||
for ( Ejb3Column column : columns ) {
|
||||
for ( AnnotatedColumn column : columns ) {
|
||||
column.addIndex( index, inSecondPass );
|
||||
}
|
||||
}
|
||||
|
@ -2438,13 +2438,13 @@ public final class AnnotationBinder {
|
|||
NaturalId naturalIdAnn = property.getAnnotation( NaturalId.class );
|
||||
if ( naturalIdAnn != null ) {
|
||||
if ( joinColumns != null ) {
|
||||
for ( Ejb3Column column : joinColumns ) {
|
||||
for ( AnnotatedColumn column : joinColumns ) {
|
||||
String keyName = "UK_" + Constraint.hashedName( column.getTable().getName() + "_NaturalID" );
|
||||
column.addUniqueKey( keyName, inSecondPass );
|
||||
}
|
||||
}
|
||||
else {
|
||||
for ( Ejb3Column column : columns ) {
|
||||
for ( AnnotatedColumn column : columns ) {
|
||||
String keyName = "UK_" + Constraint.hashedName( column.getTable().getName() + "_NaturalID" );
|
||||
column.addUniqueKey( keyName, inSecondPass );
|
||||
}
|
||||
|
@ -2666,7 +2666,7 @@ public final class AnnotationBinder {
|
|||
annJoins = null;
|
||||
annInverseJoins = null;
|
||||
}
|
||||
Ejb3JoinColumn[] joinColumns = Ejb3JoinColumn.buildJoinTableJoinColumns(
|
||||
AnnotatedJoinColumn[] joinColumns = AnnotatedJoinColumn.buildJoinTableJoinColumns(
|
||||
annJoins,
|
||||
entityBinder.getSecondaryTables(),
|
||||
propertyHolder,
|
||||
|
@ -2674,7 +2674,7 @@ public final class AnnotationBinder {
|
|||
mappedBy,
|
||||
buildingContext
|
||||
);
|
||||
Ejb3JoinColumn[] inverseJoinColumns = Ejb3JoinColumn.buildJoinTableJoinColumns(
|
||||
AnnotatedJoinColumn[] inverseJoinColumns = AnnotatedJoinColumn.buildJoinTableJoinColumns(
|
||||
annInverseJoins,
|
||||
entityBinder.getSecondaryTables(),
|
||||
propertyHolder,
|
||||
|
@ -2700,7 +2700,7 @@ public final class AnnotationBinder {
|
|||
Map<XClass, InheritanceState> inheritanceStatePerClass,
|
||||
String referencedEntityName, //is a component who is overridden by a @MapsId
|
||||
Class<? extends EmbeddableInstantiator> customInstantiatorImpl,
|
||||
Ejb3JoinColumn[] columns) {
|
||||
AnnotatedJoinColumn[] columns) {
|
||||
Component comp;
|
||||
if ( referencedEntityName != null ) {
|
||||
comp = createComponent( propertyHolder, inferredData, isComponentEmbedded, isIdentifierMapper, customInstantiatorImpl, buildingContext );
|
||||
|
@ -2967,7 +2967,7 @@ public final class AnnotationBinder {
|
|||
String generatorName,
|
||||
PropertyData inferredData,
|
||||
PropertyData baseInferredData,
|
||||
Ejb3Column[] columns,
|
||||
AnnotatedColumn[] columns,
|
||||
PropertyHolder propertyHolder,
|
||||
boolean isComposite,
|
||||
AccessType propertyAccessor,
|
||||
|
@ -3020,7 +3020,7 @@ public final class AnnotationBinder {
|
|||
else {
|
||||
//TODO I think this branch is never used. Remove.
|
||||
|
||||
for ( Ejb3Column column : columns ) {
|
||||
for ( AnnotatedColumn column : columns ) {
|
||||
column.forceNotNull(); //this is an id
|
||||
}
|
||||
final BasicValueBinder value = new BasicValueBinder( BasicValueBinder.Kind.ATTRIBUTE, buildingContext );
|
||||
|
@ -3100,7 +3100,7 @@ public final class AnnotationBinder {
|
|||
|
||||
private static void bindManyToOne(
|
||||
String cascadeStrategy,
|
||||
Ejb3JoinColumn[] columns,
|
||||
AnnotatedJoinColumn[] columns,
|
||||
boolean optional,
|
||||
boolean ignoreNotFound,
|
||||
boolean cascadeOnDelete,
|
||||
|
@ -3126,13 +3126,13 @@ public final class AnnotationBinder {
|
|||
value.setCascadeDeleteEnabled( cascadeOnDelete );
|
||||
//value.setLazy( fetchMode != FetchMode.JOIN );
|
||||
if ( !optional ) {
|
||||
for ( Ejb3JoinColumn column : columns ) {
|
||||
for ( AnnotatedJoinColumn column : columns ) {
|
||||
column.setNullable( false );
|
||||
}
|
||||
}
|
||||
if ( property.isAnnotationPresent( MapsId.class ) ) {
|
||||
//read only
|
||||
for ( Ejb3JoinColumn column : columns ) {
|
||||
for ( AnnotatedJoinColumn column : columns ) {
|
||||
column.setInsertable( false );
|
||||
column.setUpdatable( false );
|
||||
}
|
||||
|
@ -3156,7 +3156,7 @@ public final class AnnotationBinder {
|
|||
&& joinColumn.name().equals( columnName )
|
||||
&& !property.isAnnotationPresent( MapsId.class ) ) {
|
||||
hasSpecjManyToOne = true;
|
||||
for ( Ejb3JoinColumn column : columns ) {
|
||||
for ( AnnotatedJoinColumn column : columns ) {
|
||||
column.setInsertable( false );
|
||||
column.setUpdatable( false );
|
||||
}
|
||||
|
@ -3191,7 +3191,7 @@ public final class AnnotationBinder {
|
|||
else {
|
||||
context.getMetadataCollector().addSecondPass( secondPass );
|
||||
}
|
||||
Ejb3Column.checkPropertyConsistency( columns, propertyHolder.getEntityName() + "." + propertyName );
|
||||
AnnotatedColumn.checkPropertyConsistency( columns, propertyHolder.getEntityName() + "." + propertyName );
|
||||
//PropertyBinder binder = new PropertyBinder();
|
||||
propertyBinder.setName( propertyName );
|
||||
propertyBinder.setValue( value );
|
||||
|
@ -3272,7 +3272,7 @@ public final class AnnotationBinder {
|
|||
|
||||
private static void bindOneToOne(
|
||||
String cascadeStrategy,
|
||||
Ejb3JoinColumn[] joinColumns,
|
||||
AnnotatedJoinColumn[] joinColumns,
|
||||
boolean optional,
|
||||
FetchMode fetchMode,
|
||||
boolean ignoreNotFound,
|
||||
|
@ -3310,7 +3310,7 @@ public final class AnnotationBinder {
|
|||
currentColumn = ( org.hibernate.mapping.Column ) idColumns.next();
|
||||
idColumnNames.add( currentColumn.getName() );
|
||||
}
|
||||
for ( Ejb3JoinColumn col : joinColumns ) {
|
||||
for ( AnnotatedJoinColumn col : joinColumns ) {
|
||||
if ( !idColumnNames.contains( col.getMappingColumn().getName() ) ) {
|
||||
mapToPK = false;
|
||||
break;
|
||||
|
@ -3359,7 +3359,7 @@ public final class AnnotationBinder {
|
|||
|
||||
private static void bindAny(
|
||||
String cascadeStrategy,
|
||||
Ejb3JoinColumn[] columns,
|
||||
AnnotatedJoinColumn[] columns,
|
||||
boolean cascadeOnDelete,
|
||||
Nullability nullability,
|
||||
PropertyHolder propertyHolder,
|
||||
|
|
|
@ -111,7 +111,7 @@ public class BinderHelper {
|
|||
|
||||
|
||||
public static void createSyntheticPropertyReference(
|
||||
Ejb3JoinColumn[] columns,
|
||||
AnnotatedJoinColumn[] columns,
|
||||
PersistentClass ownerEntity,
|
||||
PersistentClass associatedEntity,
|
||||
Value value,
|
||||
|
@ -121,11 +121,11 @@ public class BinderHelper {
|
|||
if ( columns[0].isImplicit() || StringHelper.isNotEmpty( columns[0].getMappedBy() ) ) {
|
||||
return;
|
||||
}
|
||||
int fkEnum = Ejb3JoinColumn.checkReferencedColumnsType( columns, ownerEntity, context );
|
||||
int fkEnum = AnnotatedJoinColumn.checkReferencedColumnsType( columns, ownerEntity, context );
|
||||
PersistentClass associatedClass = columns[0].getPropertyHolder() != null ?
|
||||
columns[0].getPropertyHolder().getPersistentClass() :
|
||||
null;
|
||||
if ( Ejb3JoinColumn.NON_PK_REFERENCE == fkEnum ) {
|
||||
if ( AnnotatedJoinColumn.NON_PK_REFERENCE == fkEnum ) {
|
||||
/**
|
||||
* Create a synthetic property to refer to including an
|
||||
* embedded component value containing all the properties
|
||||
|
@ -172,7 +172,7 @@ public class BinderHelper {
|
|||
//TODO use a ToOne type doing a second select
|
||||
StringBuilder columnsList = new StringBuilder();
|
||||
columnsList.append( "referencedColumnNames(" );
|
||||
for (Ejb3JoinColumn column : columns) {
|
||||
for (AnnotatedJoinColumn column : columns) {
|
||||
columnsList.append( column.getReferencedColumn() ).append( ", " );
|
||||
}
|
||||
columnsList.setLength( columnsList.length() - 2 );
|
||||
|
@ -237,7 +237,7 @@ public class BinderHelper {
|
|||
|
||||
private static List<Property> findPropertiesByColumns(
|
||||
Object columnOwner,
|
||||
Ejb3JoinColumn[] columns,
|
||||
AnnotatedJoinColumn[] columns,
|
||||
MetadataBuildingContext context) {
|
||||
Map<Column, Set<Property>> columnsToProperty = new HashMap<>();
|
||||
List<Column> orderedColumns = new ArrayList<>( columns.length );
|
||||
|
@ -256,7 +256,7 @@ public class BinderHelper {
|
|||
);
|
||||
}
|
||||
//build the list of column names
|
||||
for (Ejb3JoinColumn column1 : columns) {
|
||||
for (AnnotatedJoinColumn column1 : columns) {
|
||||
Column column = new Column(
|
||||
context.getMetadataCollector().getPhysicalColumnName(
|
||||
referencedTable,
|
||||
|
@ -801,7 +801,7 @@ public class BinderHelper {
|
|||
public static Any buildAnyValue(
|
||||
jakarta.persistence.Column discriminatorColumn,
|
||||
Formula discriminatorFormula,
|
||||
Ejb3JoinColumn[] keyColumns,
|
||||
AnnotatedJoinColumn[] keyColumns,
|
||||
PropertyData inferredData,
|
||||
boolean cascadeOnDelete,
|
||||
boolean lazy,
|
||||
|
@ -818,7 +818,7 @@ public class BinderHelper {
|
|||
|
||||
final BasicValueBinder discriminatorValueBinder = new BasicValueBinder( BasicValueBinder.Kind.ANY_DISCRIMINATOR, context );
|
||||
|
||||
final Ejb3Column[] discriminatorColumns = Ejb3Column.buildColumnFromAnnotation(
|
||||
final AnnotatedColumn[] discriminatorColumns = AnnotatedColumn.buildColumnFromAnnotation(
|
||||
new jakarta.persistence.Column[] { discriminatorColumn },
|
||||
discriminatorFormula,
|
||||
null,
|
||||
|
@ -860,7 +860,7 @@ public class BinderHelper {
|
|||
keyValueBinder.setColumns( keyColumns );
|
||||
|
||||
if ( !optional ) {
|
||||
for (Ejb3JoinColumn column : keyColumns) {
|
||||
for (AnnotatedJoinColumn column : keyColumns) {
|
||||
column.setNullable( false );
|
||||
}
|
||||
}
|
||||
|
@ -868,7 +868,7 @@ public class BinderHelper {
|
|||
final BasicValue keyDescriptor = keyValueBinder.make();
|
||||
value.setKey( keyDescriptor );
|
||||
keyValueBinder.fillSimpleValue();
|
||||
Ejb3Column.checkPropertyConsistency( keyColumns, propertyHolder.getEntityName() + "." + inferredData.getPropertyName() );
|
||||
AnnotatedColumn.checkPropertyConsistency( keyColumns, propertyHolder.getEntityName() + "." + inferredData.getPropertyName() );
|
||||
keyColumns[0].linkWithValue( keyDescriptor );
|
||||
|
||||
return value;
|
||||
|
|
|
@ -175,7 +175,7 @@ public class ClassPropertyHolder extends AbstractPropertyHolder {
|
|||
return persistentClass.getEntityName();
|
||||
}
|
||||
|
||||
public void addProperty(Property prop, Ejb3Column[] columns, XClass declaringClass) {
|
||||
public void addProperty(Property prop, AnnotatedColumn[] columns, XClass declaringClass) {
|
||||
//Ejb3Column.checkPropertyConsistency( ); //already called earlier
|
||||
if ( columns != null && columns[0].isSecondary() ) {
|
||||
//TODO move the getJoin() code here?
|
||||
|
|
|
@ -309,7 +309,7 @@ public class CollectionPropertyHolder extends AbstractPropertyHolder {
|
|||
return collection.getOwner().getEntityName();
|
||||
}
|
||||
|
||||
public void addProperty(Property prop, Ejb3Column[] columns, XClass declaringClass) {
|
||||
public void addProperty(Property prop, AnnotatedColumn[] columns, XClass declaringClass) {
|
||||
//Ejb3Column.checkPropertyConsistency( ); //already called earlier
|
||||
throw new AssertionFailure( "addProperty to a join table of a collection: does it make sense?" );
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ class ColumnsBuilder {
|
|||
private PropertyData inferredData;
|
||||
private EntityBinder entityBinder;
|
||||
private MetadataBuildingContext buildingContext;
|
||||
private Ejb3Column[] columns;
|
||||
private Ejb3JoinColumn[] joinColumns;
|
||||
private AnnotatedColumn[] columns;
|
||||
private AnnotatedJoinColumn[] joinColumns;
|
||||
|
||||
public ColumnsBuilder(
|
||||
PropertyHolder propertyHolder,
|
||||
|
@ -60,11 +60,11 @@ class ColumnsBuilder {
|
|||
this.buildingContext = buildingContext;
|
||||
}
|
||||
|
||||
public Ejb3Column[] getColumns() {
|
||||
public AnnotatedColumn[] getColumns() {
|
||||
return columns;
|
||||
}
|
||||
|
||||
public Ejb3JoinColumn[] getJoinColumns() {
|
||||
public AnnotatedJoinColumn[] getJoinColumns() {
|
||||
return joinColumns;
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ class ColumnsBuilder {
|
|||
if ( property.isAnnotationPresent( Column.class ) || property.isAnnotationPresent( Formula.class ) ) {
|
||||
Column ann = property.getAnnotation( Column.class );
|
||||
Formula formulaAnn = property.getAnnotation( Formula.class );
|
||||
columns = Ejb3Column.buildColumnFromAnnotation(
|
||||
columns = AnnotatedColumn.buildColumnFromAnnotation(
|
||||
new Column[] { ann },
|
||||
formulaAnn,
|
||||
property.getAnnotation( Comment.class ),
|
||||
|
@ -89,7 +89,7 @@ class ColumnsBuilder {
|
|||
}
|
||||
else if ( property.isAnnotationPresent( Columns.class ) ) {
|
||||
Columns anns = property.getAnnotation( Columns.class );
|
||||
columns = Ejb3Column.buildColumnFromAnnotation(
|
||||
columns = AnnotatedColumn.buildColumnFromAnnotation(
|
||||
anns.columns(),
|
||||
null,
|
||||
property.getAnnotation( Comment.class ),
|
||||
|
@ -116,7 +116,7 @@ class ColumnsBuilder {
|
|||
String mappedBy = oneToMany != null ?
|
||||
oneToMany.mappedBy() :
|
||||
"";
|
||||
joinColumns = Ejb3JoinColumn.buildJoinColumns(
|
||||
joinColumns = AnnotatedJoinColumn.buildJoinColumns(
|
||||
null,
|
||||
property.getAnnotation( Comment.class ),
|
||||
mappedBy,
|
||||
|
@ -132,7 +132,7 @@ class ColumnsBuilder {
|
|||
}
|
||||
if ( columns == null && !property.isAnnotationPresent( ManyToMany.class ) ) {
|
||||
//useful for collection of embedded elements
|
||||
columns = Ejb3Column.buildColumnFromAnnotation(
|
||||
columns = AnnotatedColumn.buildColumnFromAnnotation(
|
||||
null,
|
||||
null,
|
||||
property.getAnnotation( Comment.class ),
|
||||
|
@ -146,18 +146,18 @@ class ColumnsBuilder {
|
|||
|
||||
if ( nullability == Nullability.FORCED_NOT_NULL ) {
|
||||
//force columns to not null
|
||||
for (Ejb3Column col : columns ) {
|
||||
for (AnnotatedColumn col : columns ) {
|
||||
col.forceNotNull();
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
Ejb3JoinColumn[] buildDefaultJoinColumnsForXToOne(XProperty property, PropertyData inferredData) {
|
||||
Ejb3JoinColumn[] joinColumns;
|
||||
AnnotatedJoinColumn[] buildDefaultJoinColumnsForXToOne(XProperty property, PropertyData inferredData) {
|
||||
AnnotatedJoinColumn[] joinColumns;
|
||||
JoinTable joinTableAnn = propertyHolder.getJoinTable( property );
|
||||
if ( joinTableAnn != null ) {
|
||||
joinColumns = Ejb3JoinColumn.buildJoinColumns(
|
||||
joinColumns = AnnotatedJoinColumn.buildJoinColumns(
|
||||
joinTableAnn.inverseJoinColumns(),
|
||||
property.getAnnotation( Comment.class ),
|
||||
null,
|
||||
|
@ -178,7 +178,7 @@ class ColumnsBuilder {
|
|||
String mappedBy = oneToOneAnn != null
|
||||
? oneToOneAnn.mappedBy()
|
||||
: null;
|
||||
joinColumns = Ejb3JoinColumn.buildJoinColumns(
|
||||
joinColumns = AnnotatedJoinColumn.buildJoinColumns(
|
||||
null,
|
||||
property.getAnnotation( Comment.class ),
|
||||
mappedBy,
|
||||
|
@ -191,7 +191,7 @@ class ColumnsBuilder {
|
|||
return joinColumns;
|
||||
}
|
||||
|
||||
Ejb3JoinColumn[] buildExplicitJoinColumns(XProperty property, PropertyData inferredData) {
|
||||
AnnotatedJoinColumn[] buildExplicitJoinColumns(XProperty property, PropertyData inferredData) {
|
||||
//process @JoinColumn(s) before @Column(s) to handle collection of entities properly
|
||||
JoinColumn[] joinColumnAnnotations = null;
|
||||
|
||||
|
@ -208,7 +208,7 @@ class ColumnsBuilder {
|
|||
}
|
||||
|
||||
if ( joinColumnAnnotations != null ) {
|
||||
return Ejb3JoinColumn.buildJoinColumns(
|
||||
return AnnotatedJoinColumn.buildJoinColumns(
|
||||
joinColumnAnnotations,
|
||||
property.getAnnotation( Comment.class ),
|
||||
null,
|
||||
|
@ -236,7 +236,7 @@ class ColumnsBuilder {
|
|||
}
|
||||
|
||||
if (joinColumnOrFormulaAnnotations != null) {
|
||||
return Ejb3JoinColumn.buildJoinColumnsOrFormulas(
|
||||
return AnnotatedJoinColumn.buildJoinColumnsOrFormulas(
|
||||
joinColumnOrFormulaAnnotations,
|
||||
null,
|
||||
entityBinder.getSecondaryTables(),
|
||||
|
@ -248,8 +248,8 @@ class ColumnsBuilder {
|
|||
|
||||
if (property.isAnnotationPresent( JoinFormula.class)) {
|
||||
JoinFormula ann = property.getAnnotation( JoinFormula.class );
|
||||
Ejb3JoinColumn[] ejb3JoinColumns = new Ejb3JoinColumn[1];
|
||||
ejb3JoinColumns[0] = Ejb3JoinColumn.buildJoinFormula(
|
||||
AnnotatedJoinColumn[] annotatedJoinColumns = new AnnotatedJoinColumn[1];
|
||||
annotatedJoinColumns[0] = AnnotatedJoinColumn.buildJoinFormula(
|
||||
ann,
|
||||
null,
|
||||
entityBinder.getSecondaryTables(),
|
||||
|
@ -257,14 +257,14 @@ class ColumnsBuilder {
|
|||
inferredData.getPropertyName(),
|
||||
buildingContext
|
||||
);
|
||||
return ejb3JoinColumns;
|
||||
return annotatedJoinColumns;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Ejb3Column[] overrideColumnFromMapperOrMapsIdProperty(boolean isId) {
|
||||
Ejb3Column[] result = columns;
|
||||
AnnotatedColumn[] overrideColumnFromMapperOrMapsIdProperty(boolean isId) {
|
||||
AnnotatedColumn[] result = columns;
|
||||
final PropertyData overridingProperty = BinderHelper.getPropertyOverriddenByMapperOrMapsId(
|
||||
isId,
|
||||
propertyHolder,
|
||||
|
@ -280,8 +280,8 @@ class ColumnsBuilder {
|
|||
/**
|
||||
* useful to override a column either by @MapsId or by @IdClass
|
||||
*/
|
||||
Ejb3Column[] buildExcplicitOrDefaultJoinColumn(PropertyData overridingProperty) {
|
||||
Ejb3Column[] result;
|
||||
AnnotatedColumn[] buildExcplicitOrDefaultJoinColumn(PropertyData overridingProperty) {
|
||||
AnnotatedColumn[] result;
|
||||
result = buildExplicitJoinColumns( overridingProperty.getProperty(), overridingProperty );
|
||||
if (result == null) {
|
||||
result = buildDefaultJoinColumnsForXToOne( overridingProperty.getProperty(), overridingProperty);
|
||||
|
|
|
@ -275,7 +275,7 @@ public class ComponentPropertyHolder extends AbstractPropertyHolder {
|
|||
return component.getComponentClassName();
|
||||
}
|
||||
|
||||
public void addProperty(Property prop, Ejb3Column[] columns, XClass declaringClass) {
|
||||
public void addProperty(Property prop, AnnotatedColumn[] columns, XClass declaringClass) {
|
||||
//Ejb3Column.checkPropertyConsistency( ); //already called earlier
|
||||
/*
|
||||
* Check table matches between the component and the columns
|
||||
|
|
|
@ -38,12 +38,12 @@ public class CopyIdentifierComponentSecondPass extends FkSecondPass {
|
|||
private final String referencedEntityName;
|
||||
private final Component component;
|
||||
private final MetadataBuildingContext buildingContext;
|
||||
private final Ejb3JoinColumn[] joinColumns;
|
||||
private final AnnotatedJoinColumn[] joinColumns;
|
||||
|
||||
public CopyIdentifierComponentSecondPass(
|
||||
Component comp,
|
||||
String referencedEntityName,
|
||||
Ejb3JoinColumn[] joinColumns,
|
||||
AnnotatedJoinColumn[] joinColumns,
|
||||
MetadataBuildingContext buildingContext) {
|
||||
super( comp, joinColumns );
|
||||
this.component = comp;
|
||||
|
@ -83,8 +83,8 @@ public class CopyIdentifierComponentSecondPass extends FkSecondPass {
|
|||
|
||||
//prepare column name structure
|
||||
boolean isExplicitReference = true;
|
||||
Map<String, Ejb3JoinColumn> columnByReferencedName = CollectionHelper.mapOfSize( joinColumns.length);
|
||||
for (Ejb3JoinColumn joinColumn : joinColumns) {
|
||||
Map<String, AnnotatedJoinColumn> columnByReferencedName = CollectionHelper.mapOfSize( joinColumns.length);
|
||||
for (AnnotatedJoinColumn joinColumn : joinColumns) {
|
||||
final String referencedColumnName = joinColumn.getReferencedColumn();
|
||||
if ( referencedColumnName == null || BinderHelper.isEmptyAnnotationValue( referencedColumnName ) ) {
|
||||
break;
|
||||
|
@ -117,7 +117,7 @@ public class CopyIdentifierComponentSecondPass extends FkSecondPass {
|
|||
private Property createComponentProperty(
|
||||
PersistentClass referencedPersistentClass,
|
||||
boolean isExplicitReference,
|
||||
Map<String, Ejb3JoinColumn> columnByReferencedName,
|
||||
Map<String, AnnotatedJoinColumn> columnByReferencedName,
|
||||
MutableInteger index,
|
||||
Property referencedProperty ) {
|
||||
Property property = new Property();
|
||||
|
@ -156,7 +156,7 @@ public class CopyIdentifierComponentSecondPass extends FkSecondPass {
|
|||
private Property createSimpleProperty(
|
||||
PersistentClass referencedPersistentClass,
|
||||
boolean isExplicitReference,
|
||||
Map<String, Ejb3JoinColumn> columnByReferencedName,
|
||||
Map<String, AnnotatedJoinColumn> columnByReferencedName,
|
||||
MutableInteger index,
|
||||
Property referencedProperty ) {
|
||||
Property property = new Property();
|
||||
|
@ -186,7 +186,7 @@ public class CopyIdentifierComponentSecondPass extends FkSecondPass {
|
|||
continue;
|
||||
}
|
||||
final Column column = (Column) selectable;
|
||||
final Ejb3JoinColumn joinColumn;
|
||||
final AnnotatedJoinColumn joinColumn;
|
||||
String logicalColumnName = null;
|
||||
if ( isExplicitReference ) {
|
||||
logicalColumnName = column.getName();
|
||||
|
@ -222,7 +222,7 @@ public class CopyIdentifierComponentSecondPass extends FkSecondPass {
|
|||
return property;
|
||||
}
|
||||
|
||||
private void applyComponentColumnSizeValueToJoinColumn(Column column, Ejb3JoinColumn joinColumn) {
|
||||
private void applyComponentColumnSizeValueToJoinColumn(Column column, AnnotatedJoinColumn joinColumn) {
|
||||
Column mappingColumn = joinColumn.getMappingColumn();
|
||||
mappingColumn.setLength( column.getLength() );
|
||||
mappingColumn.setPrecision( column.getPrecision() );
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.hibernate.internal.util.StringHelper;
|
|||
/**
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class DefaultComponentSafeNamingStrategy extends EJB3NamingStrategy {
|
||||
public class DefaultComponentSafeNamingStrategy extends PersistenceStandardNamingStrategy {
|
||||
public static final NamingStrategy INSTANCE = new DefaultComponentSafeNamingStrategy();
|
||||
|
||||
protected static String addUnderscores(String name) {
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.hibernate.mapping.Value;
|
|||
*/
|
||||
public abstract class FkSecondPass implements SecondPass {
|
||||
protected SimpleValue value;
|
||||
protected Ejb3JoinColumn[] columns;
|
||||
protected AnnotatedJoinColumn[] columns;
|
||||
/**
|
||||
* unique counter is needed to differentiate 2 instances of FKSecondPass
|
||||
* as they are compared.
|
||||
|
@ -25,7 +25,7 @@ public abstract class FkSecondPass implements SecondPass {
|
|||
private int uniqueCounter;
|
||||
private static AtomicInteger globalCounter = new AtomicInteger();
|
||||
|
||||
public FkSecondPass(SimpleValue value, Ejb3JoinColumn[] columns) {
|
||||
public FkSecondPass(SimpleValue value, AnnotatedJoinColumn[] columns) {
|
||||
this.value = value;
|
||||
this.columns = columns;
|
||||
this.uniqueCounter = globalCounter.getAndIncrement();
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.hibernate.mapping.Join;
|
|||
*
|
||||
* @author inger
|
||||
*/
|
||||
public class IndexColumn extends Ejb3Column {
|
||||
public class IndexColumn extends AnnotatedColumn {
|
||||
private int base;
|
||||
|
||||
// TODO move to a getter setter strategy for readability
|
||||
|
|
|
@ -29,7 +29,7 @@ public class IndexOrUniqueKeySecondPass implements SecondPass {
|
|||
private final String indexName;
|
||||
private final String[] columns;
|
||||
private final MetadataBuildingContext buildingContext;
|
||||
private final Ejb3Column column;
|
||||
private final AnnotatedColumn column;
|
||||
private final boolean unique;
|
||||
|
||||
/**
|
||||
|
@ -48,14 +48,14 @@ public class IndexOrUniqueKeySecondPass implements SecondPass {
|
|||
/**
|
||||
* Build an index
|
||||
*/
|
||||
public IndexOrUniqueKeySecondPass(String indexName, Ejb3Column column, MetadataBuildingContext buildingContext) {
|
||||
public IndexOrUniqueKeySecondPass(String indexName, AnnotatedColumn column, MetadataBuildingContext buildingContext) {
|
||||
this( indexName, column, buildingContext, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an index if unique is false or a Unique Key if unique is true
|
||||
*/
|
||||
public IndexOrUniqueKeySecondPass(String indexName, Ejb3Column column, MetadataBuildingContext buildingContext, boolean unique) {
|
||||
public IndexOrUniqueKeySecondPass(String indexName, AnnotatedColumn column, MetadataBuildingContext buildingContext, boolean unique) {
|
||||
this.indexName = indexName;
|
||||
this.column = column;
|
||||
this.columns = null;
|
||||
|
|
|
@ -23,7 +23,7 @@ public class JoinedSubclassFkSecondPass extends FkSecondPass {
|
|||
|
||||
public JoinedSubclassFkSecondPass(
|
||||
JoinedSubclass entity,
|
||||
Ejb3JoinColumn[] inheritanceJoinedColumns,
|
||||
AnnotatedJoinColumn[] inheritanceJoinedColumns,
|
||||
SimpleValue key,
|
||||
MetadataBuildingContext buildingContext) {
|
||||
super( key, inheritanceJoinedColumns );
|
||||
|
|
|
@ -13,7 +13,6 @@ import jakarta.persistence.JoinColumn;
|
|||
import jakarta.persistence.JoinColumns;
|
||||
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.LazyGroup;
|
||||
import org.hibernate.annotations.common.reflection.XClass;
|
||||
|
@ -47,7 +46,7 @@ public class OneToOneSecondPass implements SecondPass {
|
|||
private boolean cascadeOnDelete;
|
||||
private boolean optional;
|
||||
private String cascadeStrategy;
|
||||
private Ejb3JoinColumn[] joinColumns;
|
||||
private AnnotatedJoinColumn[] joinColumns;
|
||||
|
||||
//that sucks, we should read that from the property mainly
|
||||
public OneToOneSecondPass(
|
||||
|
@ -61,7 +60,7 @@ public class OneToOneSecondPass implements SecondPass {
|
|||
boolean cascadeOnDelete,
|
||||
boolean optional,
|
||||
String cascadeStrategy,
|
||||
Ejb3JoinColumn[] columns,
|
||||
AnnotatedJoinColumn[] columns,
|
||||
MetadataBuildingContext buildingContext) {
|
||||
this.ownerEntity = ownerEntity;
|
||||
this.ownerProperty = ownerProperty;
|
||||
|
|
|
@ -22,10 +22,10 @@ import org.xml.sax.InputSource;
|
|||
*
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class EJB3DTDEntityResolver extends DTDEntityResolver {
|
||||
public static final EntityResolver INSTANCE = new EJB3DTDEntityResolver();
|
||||
public class PersistenceStandardEntityResolver extends DTDEntityResolver {
|
||||
public static final EntityResolver INSTANCE = new PersistenceStandardEntityResolver();
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, EJB3DTDEntityResolver.class.getName() );
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, PersistenceStandardEntityResolver.class.getName() );
|
||||
|
||||
boolean resolved = false;
|
||||
|
|
@ -15,8 +15,8 @@ import org.hibernate.internal.util.StringHelper;
|
|||
*
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class EJB3NamingStrategy implements NamingStrategy, Serializable {
|
||||
public static final NamingStrategy INSTANCE = new EJB3NamingStrategy();
|
||||
public class PersistenceStandardNamingStrategy implements NamingStrategy, Serializable {
|
||||
public static final NamingStrategy INSTANCE = new PersistenceStandardNamingStrategy();
|
||||
|
||||
public String classToTableName(String className) {
|
||||
return StringHelper.unqualify( className );
|
|
@ -18,10 +18,10 @@ import org.hibernate.mapping.SimpleValue;
|
|||
*/
|
||||
public class PkDrivenByDefaultMapsIdSecondPass extends FkSecondPass {
|
||||
private final String referencedEntityName;
|
||||
private final Ejb3JoinColumn[] columns;
|
||||
private final AnnotatedJoinColumn[] columns;
|
||||
private final SimpleValue value;
|
||||
|
||||
public PkDrivenByDefaultMapsIdSecondPass(String referencedEntityName, Ejb3JoinColumn[] columns, SimpleValue value) {
|
||||
public PkDrivenByDefaultMapsIdSecondPass(String referencedEntityName, AnnotatedJoinColumn[] columns, SimpleValue value) {
|
||||
super( value, columns );
|
||||
this.referencedEntityName = referencedEntityName;
|
||||
this.columns = columns;
|
||||
|
|
|
@ -34,7 +34,7 @@ public interface PropertyHolder {
|
|||
|
||||
void addProperty(Property prop, XClass declaringClass);
|
||||
|
||||
void addProperty(Property prop, Ejb3Column[] columns, XClass declaringClass);
|
||||
void addProperty(Property prop, AnnotatedColumn[] columns, XClass declaringClass);
|
||||
|
||||
KeyValue getIdentifier();
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ToOneFkSecondPass extends FkSecondPass {
|
|||
|
||||
public ToOneFkSecondPass(
|
||||
ToOne value,
|
||||
Ejb3JoinColumn[] columns,
|
||||
AnnotatedJoinColumn[] columns,
|
||||
boolean unique,
|
||||
String entityClassName,
|
||||
String path,
|
||||
|
|
|
@ -58,8 +58,8 @@ import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
|||
import org.hibernate.boot.registry.selector.spi.StrategySelector;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.cfg.AccessType;
|
||||
import org.hibernate.cfg.Ejb3Column;
|
||||
import org.hibernate.cfg.Ejb3JoinColumn;
|
||||
import org.hibernate.cfg.AnnotatedColumn;
|
||||
import org.hibernate.cfg.AnnotatedJoinColumn;
|
||||
import org.hibernate.cfg.PkDrivenByDefaultMapsIdSecondPass;
|
||||
import org.hibernate.cfg.SetBasicValueTypeSecondPass;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
|
@ -162,7 +162,7 @@ public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
|
|||
private TimeZoneStorageType timeZoneStorageType;
|
||||
|
||||
private Table table;
|
||||
private Ejb3Column[] columns;
|
||||
private AnnotatedColumn[] columns;
|
||||
|
||||
private BasicValue basicValue;
|
||||
|
||||
|
@ -269,7 +269,7 @@ public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
|
|||
this.table = table;
|
||||
}
|
||||
|
||||
public void setColumns(Ejb3Column[] columns) {
|
||||
public void setColumns(AnnotatedColumn[] columns) {
|
||||
this.columns = columns;
|
||||
}
|
||||
|
||||
|
@ -1193,7 +1193,7 @@ public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
|
|||
}
|
||||
|
||||
private void validate() {
|
||||
Ejb3Column.checkPropertyConsistency( columns, propertyName );
|
||||
AnnotatedColumn.checkPropertyConsistency( columns, propertyName );
|
||||
}
|
||||
|
||||
public BasicValue make() {
|
||||
|
@ -1250,12 +1250,12 @@ public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
|
|||
if ( columns[0].isNameDeferred() && !buildingContext.getMetadataCollector().isInSecondPass() && referencedEntityName != null ) {
|
||||
buildingContext.getMetadataCollector().addSecondPass(
|
||||
new PkDrivenByDefaultMapsIdSecondPass(
|
||||
referencedEntityName, (Ejb3JoinColumn[]) columns, basicValue
|
||||
referencedEntityName, (AnnotatedJoinColumn[]) columns, basicValue
|
||||
)
|
||||
);
|
||||
}
|
||||
else {
|
||||
for ( Ejb3Column column : columns ) {
|
||||
for ( AnnotatedColumn column : columns ) {
|
||||
column.linkWithValue( basicValue );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,8 +70,8 @@ import org.hibernate.cfg.AvailableSettings;
|
|||
import org.hibernate.cfg.BinderHelper;
|
||||
import org.hibernate.cfg.CollectionPropertyHolder;
|
||||
import org.hibernate.cfg.CollectionSecondPass;
|
||||
import org.hibernate.cfg.Ejb3Column;
|
||||
import org.hibernate.cfg.Ejb3JoinColumn;
|
||||
import org.hibernate.cfg.AnnotatedColumn;
|
||||
import org.hibernate.cfg.AnnotatedJoinColumn;
|
||||
import org.hibernate.cfg.IndexColumn;
|
||||
import org.hibernate.cfg.InheritanceState;
|
||||
import org.hibernate.cfg.PropertyData;
|
||||
|
@ -157,7 +157,7 @@ public abstract class CollectionBinder {
|
|||
private String mappedBy;
|
||||
private XClass collectionType;
|
||||
private XClass targetEntity;
|
||||
private Ejb3JoinColumn[] inverseJoinColumns;
|
||||
private AnnotatedJoinColumn[] inverseJoinColumns;
|
||||
private String cascadeStrategy;
|
||||
private String cacheConcurrencyStrategy;
|
||||
private String cacheRegionName;
|
||||
|
@ -167,15 +167,15 @@ public abstract class CollectionBinder {
|
|||
protected String mapKeyPropertyName;
|
||||
private boolean insertable = true;
|
||||
private boolean updatable = true;
|
||||
private Ejb3JoinColumn[] fkJoinColumns;
|
||||
private AnnotatedJoinColumn[] fkJoinColumns;
|
||||
private boolean isExplicitAssociationTable;
|
||||
private Ejb3Column[] elementColumns;
|
||||
private AnnotatedColumn[] elementColumns;
|
||||
private boolean isEmbedded;
|
||||
private XProperty property;
|
||||
private boolean ignoreNotFound;
|
||||
private TableBinder tableBinder;
|
||||
private Ejb3Column[] mapKeyColumns;
|
||||
private Ejb3JoinColumn[] mapKeyManyToManyColumns;
|
||||
private AnnotatedColumn[] mapKeyColumns;
|
||||
private AnnotatedJoinColumn[] mapKeyManyToManyColumns;
|
||||
protected HashMap<String, IdentifierGeneratorDefinition> localGenerators;
|
||||
protected Map<XClass, InheritanceState> inheritanceStatePerClass;
|
||||
private XClass declaringClass;
|
||||
|
@ -237,15 +237,15 @@ public abstract class CollectionBinder {
|
|||
this.accessType = accessType;
|
||||
}
|
||||
|
||||
public void setInverseJoinColumns(Ejb3JoinColumn[] inverseJoinColumns) {
|
||||
public void setInverseJoinColumns(AnnotatedJoinColumn[] inverseJoinColumns) {
|
||||
this.inverseJoinColumns = inverseJoinColumns;
|
||||
}
|
||||
|
||||
public void setJoinColumns(Ejb3JoinColumn[] joinColumns) {
|
||||
public void setJoinColumns(AnnotatedJoinColumn[] joinColumns) {
|
||||
this.joinColumns = joinColumns;
|
||||
}
|
||||
|
||||
private Ejb3JoinColumn[] joinColumns;
|
||||
private AnnotatedJoinColumn[] joinColumns;
|
||||
|
||||
public void setPropertyHolder(PropertyHolder propertyHolder) {
|
||||
this.propertyHolder = propertyHolder;
|
||||
|
@ -849,12 +849,12 @@ public abstract class CollectionBinder {
|
|||
}
|
||||
|
||||
public SecondPass getSecondPass(
|
||||
final Ejb3JoinColumn[] fkJoinColumns,
|
||||
final Ejb3JoinColumn[] keyColumns,
|
||||
final Ejb3JoinColumn[] inverseColumns,
|
||||
final Ejb3Column[] elementColumns,
|
||||
final Ejb3Column[] mapKeyColumns,
|
||||
final Ejb3JoinColumn[] mapKeyManyToManyColumns,
|
||||
final AnnotatedJoinColumn[] fkJoinColumns,
|
||||
final AnnotatedJoinColumn[] keyColumns,
|
||||
final AnnotatedJoinColumn[] inverseColumns,
|
||||
final AnnotatedColumn[] elementColumns,
|
||||
final AnnotatedColumn[] mapKeyColumns,
|
||||
final AnnotatedJoinColumn[] mapKeyManyToManyColumns,
|
||||
final boolean isEmbedded,
|
||||
final XProperty property,
|
||||
final XClass collType,
|
||||
|
@ -890,10 +890,10 @@ public abstract class CollectionBinder {
|
|||
protected boolean bindStarToManySecondPass(
|
||||
Map<String, PersistentClass> persistentClasses,
|
||||
XClass collType,
|
||||
Ejb3JoinColumn[] fkJoinColumns,
|
||||
Ejb3JoinColumn[] keyColumns,
|
||||
Ejb3JoinColumn[] inverseColumns,
|
||||
Ejb3Column[] elementColumns,
|
||||
AnnotatedJoinColumn[] fkJoinColumns,
|
||||
AnnotatedJoinColumn[] keyColumns,
|
||||
AnnotatedJoinColumn[] inverseColumns,
|
||||
AnnotatedColumn[] elementColumns,
|
||||
boolean isEmbedded,
|
||||
XProperty property,
|
||||
boolean unique,
|
||||
|
@ -962,7 +962,7 @@ public abstract class CollectionBinder {
|
|||
protected void bindOneToManySecondPass(
|
||||
Collection collection,
|
||||
Map<String, PersistentClass> persistentClasses,
|
||||
Ejb3JoinColumn[] fkJoinColumns,
|
||||
AnnotatedJoinColumn[] fkJoinColumns,
|
||||
XClass collectionType,
|
||||
boolean cascadeDeleteEnabled,
|
||||
boolean ignoreNotFound,
|
||||
|
@ -1002,7 +1002,7 @@ public abstract class CollectionBinder {
|
|||
);
|
||||
}
|
||||
oneToMany.setAssociatedClass( associatedClass );
|
||||
for (Ejb3JoinColumn column : fkJoinColumns) {
|
||||
for (AnnotatedJoinColumn column : fkJoinColumns) {
|
||||
column.setPersistentClass( associatedClass, joins, inheritanceStatePerClass );
|
||||
column.setJoins( joins );
|
||||
collection.setCollectionTable( column.getTable() );
|
||||
|
@ -1258,7 +1258,7 @@ public abstract class CollectionBinder {
|
|||
|
||||
private static SimpleValue buildCollectionKey(
|
||||
Collection collValue,
|
||||
Ejb3JoinColumn[] joinColumns,
|
||||
AnnotatedJoinColumn[] joinColumns,
|
||||
boolean cascadeDeleteEnabled,
|
||||
boolean noConstraintByDefault,
|
||||
XProperty property,
|
||||
|
@ -1292,7 +1292,7 @@ public abstract class CollectionBinder {
|
|||
}
|
||||
DependantValue key = new DependantValue( buildingContext, collValue.getCollectionTable(), keyVal );
|
||||
key.setTypeName( null );
|
||||
Ejb3Column.checkPropertyConsistency( joinColumns, collValue.getOwnerEntityName() );
|
||||
AnnotatedColumn.checkPropertyConsistency( joinColumns, collValue.getOwnerEntityName() );
|
||||
key.setNullable( joinColumns.length == 0 || joinColumns[0].isNullable() );
|
||||
key.setUpdateable( joinColumns.length == 0 || joinColumns[0].isUpdatable() );
|
||||
key.setCascadeDeleteEnabled( cascadeDeleteEnabled );
|
||||
|
@ -1392,9 +1392,9 @@ public abstract class CollectionBinder {
|
|||
private void bindManyToManySecondPass(
|
||||
Collection collValue,
|
||||
Map<String, PersistentClass> persistentClasses,
|
||||
Ejb3JoinColumn[] joinColumns,
|
||||
Ejb3JoinColumn[] inverseJoinColumns,
|
||||
Ejb3Column[] elementColumns,
|
||||
AnnotatedJoinColumn[] joinColumns,
|
||||
AnnotatedJoinColumn[] inverseJoinColumns,
|
||||
AnnotatedColumn[] elementColumns,
|
||||
boolean isEmbedded,
|
||||
XClass collType,
|
||||
boolean ignoreNotFound, boolean unique,
|
||||
|
@ -1486,7 +1486,7 @@ public abstract class CollectionBinder {
|
|||
}
|
||||
collValue.setCollectionTable( table );
|
||||
String entityName = collectionEntity.getEntityName();
|
||||
for (Ejb3JoinColumn column : joinColumns) {
|
||||
for (AnnotatedJoinColumn column : joinColumns) {
|
||||
//column.setDefaultColumnHeader( joinColumns[0].getMappedBy() ); //seems not to be used, make sense
|
||||
column.setManyToManyOwnerSideEntityName( entityName );
|
||||
}
|
||||
|
@ -1494,7 +1494,7 @@ public abstract class CollectionBinder {
|
|||
else {
|
||||
//TODO: only for implicit columns?
|
||||
//FIXME NamingStrategy
|
||||
for (Ejb3JoinColumn column : joinColumns) {
|
||||
for (AnnotatedJoinColumn column : joinColumns) {
|
||||
String mappedByProperty = buildingContext.getMetadataCollector().getFromMappedBy(
|
||||
collValue.getOwnerEntityName(), column.getPropertyName()
|
||||
);
|
||||
|
@ -1593,7 +1593,7 @@ public abstract class CollectionBinder {
|
|||
final Formula discriminatorFormulaAnn = inferredData.getProperty().getAnnotation( Formula.class );
|
||||
|
||||
//override the table
|
||||
for (Ejb3Column column : inverseJoinColumns) {
|
||||
for (AnnotatedColumn column : inverseJoinColumns) {
|
||||
column.setTable( collValue.getCollectionTable() );
|
||||
}
|
||||
|
||||
|
@ -1740,8 +1740,8 @@ public abstract class CollectionBinder {
|
|||
final BasicValueBinder elementBinder = new BasicValueBinder( BasicValueBinder.Kind.COLLECTION_ELEMENT, buildingContext );
|
||||
elementBinder.setReturnedClassName( collType.getName() );
|
||||
if ( elementColumns == null || elementColumns.length == 0 ) {
|
||||
elementColumns = new Ejb3Column[1];
|
||||
Ejb3Column column = new Ejb3Column();
|
||||
elementColumns = new AnnotatedColumn[1];
|
||||
AnnotatedColumn column = new AnnotatedColumn();
|
||||
column.setImplicit( false );
|
||||
//not following the spec but more clean
|
||||
column.setNullable( true );
|
||||
|
@ -1753,7 +1753,7 @@ public abstract class CollectionBinder {
|
|||
elementColumns[0] = column;
|
||||
}
|
||||
//override the table
|
||||
for (Ejb3Column column : elementColumns) {
|
||||
for (AnnotatedColumn column : elementColumns) {
|
||||
column.setTable( collValue.getCollectionTable() );
|
||||
}
|
||||
elementBinder.setColumns( elementColumns );
|
||||
|
@ -1827,7 +1827,7 @@ public abstract class CollectionBinder {
|
|||
private static void bindCollectionSecondPass(
|
||||
Collection collValue,
|
||||
PersistentClass collectionEntity,
|
||||
Ejb3JoinColumn[] joinColumns,
|
||||
AnnotatedJoinColumn[] joinColumns,
|
||||
boolean cascadeDeleteEnabled,
|
||||
XProperty property,
|
||||
PropertyHolder propertyHolder,
|
||||
|
@ -1875,7 +1875,7 @@ public abstract class CollectionBinder {
|
|||
*/
|
||||
public static void bindManytoManyInverseFk(
|
||||
PersistentClass referencedEntity,
|
||||
Ejb3JoinColumn[] columns,
|
||||
AnnotatedJoinColumn[] columns,
|
||||
SimpleValue value,
|
||||
boolean unique,
|
||||
MetadataBuildingContext buildingContext) {
|
||||
|
@ -1927,15 +1927,15 @@ public abstract class CollectionBinder {
|
|||
}
|
||||
}
|
||||
|
||||
public void setFkJoinColumns(Ejb3JoinColumn[] ejb3JoinColumns) {
|
||||
this.fkJoinColumns = ejb3JoinColumns;
|
||||
public void setFkJoinColumns(AnnotatedJoinColumn[] annotatedJoinColumns) {
|
||||
this.fkJoinColumns = annotatedJoinColumns;
|
||||
}
|
||||
|
||||
public void setExplicitAssociationTable(boolean explicitAssocTable) {
|
||||
this.isExplicitAssociationTable = explicitAssocTable;
|
||||
}
|
||||
|
||||
public void setElementColumns(Ejb3Column[] elementColumns) {
|
||||
public void setElementColumns(AnnotatedColumn[] elementColumns) {
|
||||
this.elementColumns = elementColumns;
|
||||
}
|
||||
|
||||
|
@ -1951,11 +1951,11 @@ public abstract class CollectionBinder {
|
|||
this.ignoreNotFound = ignoreNotFound;
|
||||
}
|
||||
|
||||
public void setMapKeyColumns(Ejb3Column[] mapKeyColumns) {
|
||||
public void setMapKeyColumns(AnnotatedColumn[] mapKeyColumns) {
|
||||
this.mapKeyColumns = mapKeyColumns;
|
||||
}
|
||||
|
||||
public void setMapKeyManyToManyColumns(Ejb3JoinColumn[] mapJoinColumns) {
|
||||
public void setMapKeyManyToManyColumns(AnnotatedJoinColumn[] mapJoinColumns) {
|
||||
this.mapKeyManyToManyColumns = mapJoinColumns;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ import org.hibernate.boot.spi.MetadataBuildingContext;
|
|||
import org.hibernate.cfg.AccessType;
|
||||
import org.hibernate.cfg.AnnotationBinder;
|
||||
import org.hibernate.cfg.BinderHelper;
|
||||
import org.hibernate.cfg.Ejb3JoinColumn;
|
||||
import org.hibernate.cfg.AnnotatedJoinColumn;
|
||||
import org.hibernate.cfg.InheritanceState;
|
||||
import org.hibernate.cfg.ObjectNameSource;
|
||||
import org.hibernate.cfg.PropertyHolder;
|
||||
|
@ -849,7 +849,7 @@ public class EntityBinder {
|
|||
}
|
||||
|
||||
private void createPrimaryColumnsToSecondaryTable(Object uncastedColumn, PropertyHolder propertyHolder, Join join) {
|
||||
Ejb3JoinColumn[] ejb3JoinColumns;
|
||||
AnnotatedJoinColumn[] annotatedJoinColumns;
|
||||
PrimaryKeyJoinColumn[] pkColumnsAnn = null;
|
||||
JoinColumn[] joinColumnsAnn = null;
|
||||
if ( uncastedColumn instanceof PrimaryKeyJoinColumn[] ) {
|
||||
|
@ -859,8 +859,8 @@ public class EntityBinder {
|
|||
joinColumnsAnn = (JoinColumn[]) uncastedColumn;
|
||||
}
|
||||
if ( pkColumnsAnn == null && joinColumnsAnn == null ) {
|
||||
ejb3JoinColumns = new Ejb3JoinColumn[1];
|
||||
ejb3JoinColumns[0] = Ejb3JoinColumn.buildJoinColumn(
|
||||
annotatedJoinColumns = new AnnotatedJoinColumn[1];
|
||||
annotatedJoinColumns[0] = AnnotatedJoinColumn.buildJoinColumn(
|
||||
null,
|
||||
null,
|
||||
persistentClass.getIdentifier(),
|
||||
|
@ -874,8 +874,8 @@ public class EntityBinder {
|
|||
pkColumnsAnn.length :
|
||||
joinColumnsAnn.length;
|
||||
if ( nbrOfJoinColumns == 0 ) {
|
||||
ejb3JoinColumns = new Ejb3JoinColumn[1];
|
||||
ejb3JoinColumns[0] = Ejb3JoinColumn.buildJoinColumn(
|
||||
annotatedJoinColumns = new AnnotatedJoinColumn[1];
|
||||
annotatedJoinColumns[0] = AnnotatedJoinColumn.buildJoinColumn(
|
||||
null,
|
||||
null,
|
||||
persistentClass.getIdentifier(),
|
||||
|
@ -885,10 +885,10 @@ public class EntityBinder {
|
|||
);
|
||||
}
|
||||
else {
|
||||
ejb3JoinColumns = new Ejb3JoinColumn[nbrOfJoinColumns];
|
||||
annotatedJoinColumns = new AnnotatedJoinColumn[nbrOfJoinColumns];
|
||||
if ( pkColumnsAnn != null ) {
|
||||
for (int colIndex = 0; colIndex < nbrOfJoinColumns; colIndex++) {
|
||||
ejb3JoinColumns[colIndex] = Ejb3JoinColumn.buildJoinColumn(
|
||||
annotatedJoinColumns[colIndex] = AnnotatedJoinColumn.buildJoinColumn(
|
||||
pkColumnsAnn[colIndex],
|
||||
null,
|
||||
persistentClass.getIdentifier(),
|
||||
|
@ -900,7 +900,7 @@ public class EntityBinder {
|
|||
}
|
||||
else {
|
||||
for (int colIndex = 0; colIndex < nbrOfJoinColumns; colIndex++) {
|
||||
ejb3JoinColumns[colIndex] = Ejb3JoinColumn.buildJoinColumn(
|
||||
annotatedJoinColumns[colIndex] = AnnotatedJoinColumn.buildJoinColumn(
|
||||
null,
|
||||
joinColumnsAnn[colIndex],
|
||||
persistentClass.getIdentifier(),
|
||||
|
@ -913,18 +913,18 @@ public class EntityBinder {
|
|||
}
|
||||
}
|
||||
|
||||
for (Ejb3JoinColumn joinColumn : ejb3JoinColumns) {
|
||||
for (AnnotatedJoinColumn joinColumn : annotatedJoinColumns) {
|
||||
joinColumn.forceNotNull();
|
||||
}
|
||||
bindJoinToPersistentClass( join, ejb3JoinColumns, context );
|
||||
bindJoinToPersistentClass( join, annotatedJoinColumns, context );
|
||||
}
|
||||
|
||||
private void bindJoinToPersistentClass(Join join, Ejb3JoinColumn[] ejb3JoinColumns, MetadataBuildingContext buildingContext) {
|
||||
private void bindJoinToPersistentClass(Join join, AnnotatedJoinColumn[] annotatedJoinColumns, MetadataBuildingContext buildingContext) {
|
||||
SimpleValue key = new DependantValue( buildingContext, join.getTable(), persistentClass.getIdentifier() );
|
||||
join.setKey( key );
|
||||
setFKNameIfDefined( join );
|
||||
key.setCascadeDeleteEnabled( false );
|
||||
TableBinder.bindFk( persistentClass, null, ejb3JoinColumns, key, false, buildingContext );
|
||||
TableBinder.bindFk( persistentClass, null, annotatedJoinColumns, key, false, buildingContext );
|
||||
join.createPrimaryKey();
|
||||
join.createForeignKey();
|
||||
persistentClass.addJoin( join );
|
||||
|
|
|
@ -15,8 +15,8 @@ import org.hibernate.annotations.common.reflection.XClass;
|
|||
import org.hibernate.annotations.common.reflection.XProperty;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.cfg.BinderHelper;
|
||||
import org.hibernate.cfg.Ejb3Column;
|
||||
import org.hibernate.cfg.Ejb3JoinColumn;
|
||||
import org.hibernate.cfg.AnnotatedColumn;
|
||||
import org.hibernate.cfg.AnnotatedJoinColumn;
|
||||
import org.hibernate.cfg.IdGeneratorResolverSecondPass;
|
||||
import org.hibernate.cfg.PropertyData;
|
||||
import org.hibernate.cfg.PropertyInferredData;
|
||||
|
@ -47,10 +47,10 @@ public class IdBagBinder extends BagBinder {
|
|||
protected boolean bindStarToManySecondPass(
|
||||
Map persistentClasses,
|
||||
XClass collType,
|
||||
Ejb3JoinColumn[] fkJoinColumns,
|
||||
Ejb3JoinColumn[] keyColumns,
|
||||
Ejb3JoinColumn[] inverseColumns,
|
||||
Ejb3Column[] elementColumns,
|
||||
AnnotatedJoinColumn[] fkJoinColumns,
|
||||
AnnotatedJoinColumn[] keyColumns,
|
||||
AnnotatedJoinColumn[] inverseColumns,
|
||||
AnnotatedColumn[] elementColumns,
|
||||
boolean isEmbedded,
|
||||
XProperty property,
|
||||
boolean unique,
|
||||
|
@ -78,7 +78,7 @@ public class IdBagBinder extends BagBinder {
|
|||
"id"
|
||||
);
|
||||
|
||||
final Ejb3Column[] idColumns = Ejb3Column.buildColumnFromAnnotation(
|
||||
final AnnotatedColumn[] idColumns = AnnotatedColumn.buildColumnFromAnnotation(
|
||||
new Column[] { collectionIdAnn.column() },
|
||||
null,
|
||||
null,
|
||||
|
@ -90,7 +90,7 @@ public class IdBagBinder extends BagBinder {
|
|||
);
|
||||
|
||||
//we need to make sure all id columns must be not-null.
|
||||
for ( Ejb3Column idColumn:idColumns ) {
|
||||
for ( AnnotatedColumn idColumn:idColumns ) {
|
||||
idColumn.setNullable( false );
|
||||
}
|
||||
|
||||
|
|
|
@ -8,15 +8,14 @@ package org.hibernate.cfg.annotations;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.OrderBy;
|
||||
import org.hibernate.annotations.common.reflection.XClass;
|
||||
import org.hibernate.annotations.common.reflection.XProperty;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.cfg.CollectionSecondPass;
|
||||
import org.hibernate.cfg.Ejb3Column;
|
||||
import org.hibernate.cfg.Ejb3JoinColumn;
|
||||
import org.hibernate.cfg.AnnotatedColumn;
|
||||
import org.hibernate.cfg.AnnotatedJoinColumn;
|
||||
import org.hibernate.cfg.PropertyHolder;
|
||||
import org.hibernate.cfg.PropertyHolderBuilder;
|
||||
import org.hibernate.cfg.SecondPass;
|
||||
|
@ -60,12 +59,12 @@ public class ListBinder extends CollectionBinder {
|
|||
|
||||
@Override
|
||||
public SecondPass getSecondPass(
|
||||
final Ejb3JoinColumn[] fkJoinColumns,
|
||||
final Ejb3JoinColumn[] keyColumns,
|
||||
final Ejb3JoinColumn[] inverseColumns,
|
||||
final Ejb3Column[] elementColumns,
|
||||
Ejb3Column[] mapKeyColumns,
|
||||
final Ejb3JoinColumn[] mapKeyManyToManyColumns,
|
||||
final AnnotatedJoinColumn[] fkJoinColumns,
|
||||
final AnnotatedJoinColumn[] keyColumns,
|
||||
final AnnotatedJoinColumn[] inverseColumns,
|
||||
final AnnotatedColumn[] elementColumns,
|
||||
AnnotatedColumn[] mapKeyColumns,
|
||||
final AnnotatedJoinColumn[] mapKeyManyToManyColumns,
|
||||
final boolean isEmbedded,
|
||||
final XProperty property,
|
||||
final XClass collType,
|
||||
|
@ -118,7 +117,7 @@ public class ListBinder extends CollectionBinder {
|
|||
}
|
||||
indexColumn.setPropertyHolder( valueHolder );
|
||||
final BasicValueBinder valueBinder = new BasicValueBinder( BasicValueBinder.Kind.LIST_INDEX, buildingContext );
|
||||
valueBinder.setColumns( new Ejb3Column[] { indexColumn } );
|
||||
valueBinder.setColumns( new AnnotatedColumn[] { indexColumn } );
|
||||
valueBinder.setReturnedClassName( Integer.class.getName() );
|
||||
valueBinder.setType( property, collType, null, null );
|
||||
// valueBinder.setExplicitType( "integer" );
|
||||
|
|
|
@ -24,8 +24,8 @@ import org.hibernate.cfg.AnnotationBinder;
|
|||
import org.hibernate.cfg.BinderHelper;
|
||||
import org.hibernate.cfg.CollectionPropertyHolder;
|
||||
import org.hibernate.cfg.CollectionSecondPass;
|
||||
import org.hibernate.cfg.Ejb3Column;
|
||||
import org.hibernate.cfg.Ejb3JoinColumn;
|
||||
import org.hibernate.cfg.AnnotatedColumn;
|
||||
import org.hibernate.cfg.AnnotatedJoinColumn;
|
||||
import org.hibernate.cfg.InheritanceState;
|
||||
import org.hibernate.cfg.PropertyData;
|
||||
import org.hibernate.cfg.PropertyHolderBuilder;
|
||||
|
@ -78,12 +78,12 @@ public class MapBinder extends CollectionBinder {
|
|||
|
||||
@Override
|
||||
public SecondPass getSecondPass(
|
||||
final Ejb3JoinColumn[] fkJoinColumns,
|
||||
final Ejb3JoinColumn[] keyColumns,
|
||||
final Ejb3JoinColumn[] inverseColumns,
|
||||
final Ejb3Column[] elementColumns,
|
||||
final Ejb3Column[] mapKeyColumns,
|
||||
final Ejb3JoinColumn[] mapKeyManyToManyColumns,
|
||||
final AnnotatedJoinColumn[] fkJoinColumns,
|
||||
final AnnotatedJoinColumn[] keyColumns,
|
||||
final AnnotatedJoinColumn[] inverseColumns,
|
||||
final AnnotatedColumn[] elementColumns,
|
||||
final AnnotatedColumn[] mapKeyColumns,
|
||||
final AnnotatedJoinColumn[] mapKeyManyToManyColumns,
|
||||
final boolean isEmbedded,
|
||||
final XProperty property,
|
||||
final XClass collType,
|
||||
|
@ -159,8 +159,8 @@ public class MapBinder extends CollectionBinder {
|
|||
XProperty property,
|
||||
boolean isEmbedded,
|
||||
MetadataBuildingContext buildingContext,
|
||||
Ejb3Column[] mapKeyColumns,
|
||||
Ejb3JoinColumn[] mapKeyManyToManyColumns,
|
||||
AnnotatedColumn[] mapKeyColumns,
|
||||
AnnotatedJoinColumn[] mapKeyManyToManyColumns,
|
||||
String targetPropertyName) {
|
||||
if ( mapKeyPropertyName != null ) {
|
||||
//this is an EJB3 @MapKey
|
||||
|
@ -302,10 +302,10 @@ public class MapBinder extends CollectionBinder {
|
|||
final BasicValueBinder elementBinder = new BasicValueBinder( BasicValueBinder.Kind.MAP_KEY, buildingContext );
|
||||
elementBinder.setReturnedClassName( mapKeyType );
|
||||
|
||||
Ejb3Column[] elementColumns = mapKeyColumns;
|
||||
AnnotatedColumn[] elementColumns = mapKeyColumns;
|
||||
if ( elementColumns == null || elementColumns.length == 0 ) {
|
||||
elementColumns = new Ejb3Column[1];
|
||||
Ejb3Column column = new Ejb3Column();
|
||||
elementColumns = new AnnotatedColumn[1];
|
||||
AnnotatedColumn column = new AnnotatedColumn();
|
||||
column.setImplicit( false );
|
||||
column.setNullable( true );
|
||||
column.setLength( Size.DEFAULT_LENGTH );
|
||||
|
@ -317,7 +317,7 @@ public class MapBinder extends CollectionBinder {
|
|||
elementColumns[0] = column;
|
||||
}
|
||||
//override the table
|
||||
for (Ejb3Column column : elementColumns) {
|
||||
for (AnnotatedColumn column : elementColumns) {
|
||||
column.setTable( mapValue.getCollectionTable() );
|
||||
}
|
||||
elementBinder.setColumns( elementColumns );
|
||||
|
@ -337,7 +337,7 @@ public class MapBinder extends CollectionBinder {
|
|||
//FIXME pass the Index Entity JoinColumns
|
||||
if ( !collection.isOneToMany() ) {
|
||||
//index column should not be null
|
||||
for (Ejb3JoinColumn col : mapKeyManyToManyColumns) {
|
||||
for (AnnotatedJoinColumn col : mapKeyManyToManyColumns) {
|
||||
col.forceNotNull();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.hibernate.boot.spi.MetadataBuildingContext;
|
|||
import org.hibernate.cfg.AccessType;
|
||||
import org.hibernate.cfg.AnnotationBinder;
|
||||
import org.hibernate.cfg.BinderHelper;
|
||||
import org.hibernate.cfg.Ejb3Column;
|
||||
import org.hibernate.cfg.AnnotatedColumn;
|
||||
import org.hibernate.cfg.InheritanceState;
|
||||
import org.hibernate.cfg.PropertyHolder;
|
||||
import org.hibernate.cfg.PropertyPreloadedData;
|
||||
|
@ -65,7 +65,7 @@ public class PropertyBinder {
|
|||
private boolean lazy;
|
||||
private String lazyGroup;
|
||||
private AccessType accessType;
|
||||
private Ejb3Column[] columns;
|
||||
private AnnotatedColumn[] columns;
|
||||
private PropertyHolder holder;
|
||||
private Value value;
|
||||
private boolean insertable = true;
|
||||
|
@ -129,7 +129,7 @@ public class PropertyBinder {
|
|||
this.accessType = accessType;
|
||||
}
|
||||
|
||||
public void setColumns(Ejb3Column[] columns) {
|
||||
public void setColumns(AnnotatedColumn[] columns) {
|
||||
insertable = columns[0].isInsertable();
|
||||
updatable = columns[0].isUpdatable();
|
||||
//consistency is checked later when we know the property name
|
||||
|
|
|
@ -24,12 +24,10 @@ import org.hibernate.boot.model.source.spi.AttributePath;
|
|||
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.cfg.BinderHelper;
|
||||
import org.hibernate.cfg.Ejb3JoinColumn;
|
||||
import org.hibernate.cfg.AnnotatedJoinColumn;
|
||||
import org.hibernate.cfg.IndexOrUniqueKeySecondPass;
|
||||
import org.hibernate.cfg.JPAIndexHolder;
|
||||
import org.hibernate.cfg.ObjectNameSource;
|
||||
import org.hibernate.cfg.SimpleToOneFkSecondPass;
|
||||
import org.hibernate.cfg.ToOneFkSecondPass;
|
||||
import org.hibernate.cfg.UniqueConstraintHolder;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
|
@ -536,7 +534,7 @@ public class TableBinder {
|
|||
public static void bindFk(
|
||||
PersistentClass referencedEntity,
|
||||
PersistentClass destinationEntity,
|
||||
Ejb3JoinColumn[] columns,
|
||||
AnnotatedJoinColumn[] columns,
|
||||
SimpleValue value,
|
||||
boolean unique,
|
||||
MetadataBuildingContext buildingContext) {
|
||||
|
@ -599,9 +597,9 @@ public class TableBinder {
|
|||
}
|
||||
}
|
||||
else {
|
||||
int fkEnum = Ejb3JoinColumn.checkReferencedColumnsType( columns, referencedEntity, buildingContext );
|
||||
int fkEnum = AnnotatedJoinColumn.checkReferencedColumnsType( columns, referencedEntity, buildingContext );
|
||||
|
||||
if ( Ejb3JoinColumn.NON_PK_REFERENCE == fkEnum ) {
|
||||
if ( AnnotatedJoinColumn.NON_PK_REFERENCE == fkEnum ) {
|
||||
String referencedPropertyName;
|
||||
if ( value instanceof ToOne ) {
|
||||
referencedPropertyName = ( (ToOne) value ).getReferencedPropertyName();
|
||||
|
@ -641,7 +639,7 @@ public class TableBinder {
|
|||
|
||||
}
|
||||
else {
|
||||
if ( Ejb3JoinColumn.NO_REFERENCE == fkEnum ) {
|
||||
if ( AnnotatedJoinColumn.NO_REFERENCE == fkEnum ) {
|
||||
//implicit case, we hope PK and FK columns are in the same order
|
||||
if ( columns.length != referencedEntity.getIdentifier().getColumnSpan() ) {
|
||||
throw new AnnotationException(
|
||||
|
@ -676,7 +674,7 @@ public class TableBinder {
|
|||
//for each PK column, find the associated FK column.
|
||||
col = (Column) idColItr.next();
|
||||
final String colName = col.getQuotedName( buildingContext.getMetadataCollector().getDatabase().getJdbcEnvironment().getDialect() );
|
||||
for (Ejb3JoinColumn joinCol : columns) {
|
||||
for (AnnotatedJoinColumn joinCol : columns) {
|
||||
String referencedColumn = joinCol.getReferencedColumn();
|
||||
referencedColumn = buildingContext.getMetadataCollector().getPhysicalColumnName(
|
||||
table,
|
||||
|
@ -721,9 +719,9 @@ public class TableBinder {
|
|||
public static void linkJoinColumnWithValueOverridingNameIfImplicit(
|
||||
PersistentClass referencedEntity,
|
||||
Iterator columnIterator,
|
||||
Ejb3JoinColumn[] columns,
|
||||
AnnotatedJoinColumn[] columns,
|
||||
SimpleValue value) {
|
||||
for (Ejb3JoinColumn joinCol : columns) {
|
||||
for (AnnotatedJoinColumn joinCol : columns) {
|
||||
Column synthCol = (Column) columnIterator.next();
|
||||
if ( joinCol.isNameDeferred() ) {
|
||||
//this has to be the default value
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.hibernate.MappingException;
|
|||
import org.hibernate.annotations.common.reflection.XClass;
|
||||
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.cfg.Ejb3JoinColumn;
|
||||
import org.hibernate.cfg.AnnotatedJoinColumn;
|
||||
import org.hibernate.cfg.InheritanceState;
|
||||
import org.hibernate.cfg.PropertyHolder;
|
||||
import org.hibernate.cfg.annotations.CollectionBinder;
|
||||
|
@ -74,7 +74,7 @@ public class CollectionBinderTest extends BaseUnitTestCase {
|
|||
public void bindOneToManySecondPass(
|
||||
Collection collection,
|
||||
Map<String, PersistentClass> persistentClasses,
|
||||
Ejb3JoinColumn[] fkJoinColumns,
|
||||
AnnotatedJoinColumn[] fkJoinColumns,
|
||||
XClass collectionType,
|
||||
boolean cascadeDeleteEnabled,
|
||||
boolean ignoreNotFound,
|
||||
|
|
|
@ -13,7 +13,7 @@ import jakarta.persistence.InheritanceType;
|
|||
import jakarta.persistence.Table;
|
||||
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.cfg.Ejb3DiscriminatorColumn;
|
||||
import org.hibernate.cfg.AnnotatedDiscriminatorColumn;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.JoinedSubclassEntityPersister;
|
||||
|
||||
|
@ -54,11 +54,11 @@ public class JoinedSubclassWithImplicitDiscriminatorTest {
|
|||
assertNotNull( p );
|
||||
final JoinedSubclassEntityPersister dogPersister = assertTyping( JoinedSubclassEntityPersister.class, p );
|
||||
assertEquals(
|
||||
Ejb3DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE,
|
||||
AnnotatedDiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE,
|
||||
dogPersister.getDiscriminatorType().getName()
|
||||
);
|
||||
assertEquals(
|
||||
Ejb3DiscriminatorColumn.DEFAULT_DISCRIMINATOR_COLUMN_NAME,
|
||||
AnnotatedDiscriminatorColumn.DEFAULT_DISCRIMINATOR_COLUMN_NAME,
|
||||
dogPersister.getDiscriminatorColumnName()
|
||||
);
|
||||
assertEquals( "Dog", dogPersister.getDiscriminatorValue() );
|
||||
|
@ -67,11 +67,11 @@ public class JoinedSubclassWithImplicitDiscriminatorTest {
|
|||
assertNotNull( p );
|
||||
final JoinedSubclassEntityPersister catPersister = assertTyping( JoinedSubclassEntityPersister.class, p );
|
||||
assertEquals(
|
||||
Ejb3DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE,
|
||||
AnnotatedDiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE,
|
||||
catPersister.getDiscriminatorType().getName()
|
||||
);
|
||||
assertEquals(
|
||||
Ejb3DiscriminatorColumn.DEFAULT_DISCRIMINATOR_COLUMN_NAME,
|
||||
AnnotatedDiscriminatorColumn.DEFAULT_DISCRIMINATOR_COLUMN_NAME,
|
||||
catPersister.getDiscriminatorColumnName()
|
||||
);
|
||||
assertEquals( "Cat", catPersister.getDiscriminatorValue() );
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl;
|
|||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.cfg.AnnotatedJoinColumn;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.mapping.Column;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
|
@ -30,7 +31,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
|
|||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* Tests {@link org.hibernate.cfg.Ejb3JoinColumn} and {@link org.hibernate.boot.model.naming.PhysicalNamingStrategy}
|
||||
* Tests {@link AnnotatedJoinColumn} and {@link org.hibernate.boot.model.naming.PhysicalNamingStrategy}
|
||||
* interaction
|
||||
*
|
||||
* @author Anton Wimmer
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
|
||||
//$Id$
|
||||
package org.hibernate.test.annotations;
|
||||
import org.hibernate.cfg.EJB3NamingStrategy;
|
||||
import org.hibernate.cfg.PersistenceStandardNamingStrategy;
|
||||
import org.hibernate.cfg.NamingStrategy;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class AlternativeNamingStrategy extends EJB3NamingStrategy {
|
||||
public class AlternativeNamingStrategy extends PersistenceStandardNamingStrategy {
|
||||
public static NamingStrategy INSTANCE = new AlternativeNamingStrategy();
|
||||
|
||||
public String classToTableName(String className) {
|
||||
|
|
Loading…
Reference in New Issue