HHH-10372 - Fix Sequence generator for idbag ignores generator parameters
This commit is contained in:
parent
a9e4eb4895
commit
030f442f3c
|
@ -39,6 +39,12 @@ public class IdentifierGeneratorDefinition implements Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IdentifierGeneratorDefinition(
|
||||||
|
final String name,
|
||||||
|
final Map<String, String> parameters) {
|
||||||
|
this( name, name, parameters );
|
||||||
|
}
|
||||||
|
|
||||||
public IdentifierGeneratorDefinition(String name) {
|
public IdentifierGeneratorDefinition(String name) {
|
||||||
this( name, name );
|
this( name, name );
|
||||||
}
|
}
|
||||||
|
|
|
@ -3386,7 +3386,7 @@ public class ModelBinder {
|
||||||
|
|
||||||
makeIdentifier(
|
makeIdentifier(
|
||||||
mappingDocument,
|
mappingDocument,
|
||||||
new IdentifierGeneratorDefinition( idSource.getGeneratorName() ),
|
new IdentifierGeneratorDefinition( idSource.getGeneratorName(), idSource.getParameters() ),
|
||||||
null,
|
null,
|
||||||
idBinding
|
idBinding
|
||||||
);
|
);
|
||||||
|
|
|
@ -6,8 +6,10 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.boot.model.source.internal.hbm;
|
package org.hibernate.boot.model.source.internal.hbm;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.boot.MappingException;
|
import org.hibernate.boot.MappingException;
|
||||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmIdBagCollectionType;
|
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmIdBagCollectionType;
|
||||||
|
@ -19,6 +21,7 @@ import org.hibernate.boot.model.source.spi.PluralAttributeNature;
|
||||||
import org.hibernate.boot.model.source.spi.RelationalValueSource;
|
import org.hibernate.boot.model.source.spi.RelationalValueSource;
|
||||||
import org.hibernate.boot.model.source.spi.SizeSource;
|
import org.hibernate.boot.model.source.spi.SizeSource;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
|
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
@ -81,10 +84,12 @@ public class PluralAttributeSourceIdBagImpl extends AbstractPluralAttributeSourc
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.collectionIdSource = new CollectionIdSourceImpl(
|
this.collectionIdSource = new CollectionIdSourceImpl(
|
||||||
(ColumnSource) collectionIdRelationalValueSource,
|
(ColumnSource) collectionIdRelationalValueSource,
|
||||||
new HibernateTypeSourceImpl( idBagMapping.getCollectionId().getType() ),
|
new HibernateTypeSourceImpl( idBagMapping.getCollectionId().getType() ),
|
||||||
idBagMapping.getCollectionId().getGenerator().getClazz()
|
idBagMapping.getCollectionId().getGenerator().getClazz(),
|
||||||
|
Helper.extractParameters( idBagMapping.getCollectionId().getGenerator().getConfigParameters() )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,14 +127,22 @@ public class PluralAttributeSourceIdBagImpl extends AbstractPluralAttributeSourc
|
||||||
private final ColumnSource columnSource;
|
private final ColumnSource columnSource;
|
||||||
private final HibernateTypeSourceImpl typeSource;
|
private final HibernateTypeSourceImpl typeSource;
|
||||||
private final String generator;
|
private final String generator;
|
||||||
|
private final Map<String, String> parameters;
|
||||||
|
|
||||||
public CollectionIdSourceImpl(
|
public CollectionIdSourceImpl(
|
||||||
ColumnSource columnSource,
|
ColumnSource columnSource,
|
||||||
HibernateTypeSourceImpl typeSource,
|
HibernateTypeSourceImpl typeSource,
|
||||||
String generator) {
|
String generator,
|
||||||
|
final Map<String, String> parameters) {
|
||||||
this.columnSource = columnSource;
|
this.columnSource = columnSource;
|
||||||
this.typeSource = typeSource;
|
this.typeSource = typeSource;
|
||||||
this.generator = generator;
|
this.generator = generator;
|
||||||
|
if ( CollectionHelper.isEmpty( parameters ) ) {
|
||||||
|
this.parameters = Collections.emptyMap();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.parameters = Collections.unmodifiableMap( parameters );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -146,5 +159,9 @@ public class PluralAttributeSourceIdBagImpl extends AbstractPluralAttributeSourc
|
||||||
public String getGeneratorName() {
|
public String getGeneratorName() {
|
||||||
return generator;
|
return generator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getParameters() {
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.boot.model.source.spi;
|
package org.hibernate.boot.model.source.spi;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
@ -30,4 +32,9 @@ public interface CollectionIdSource {
|
||||||
* @return The identifier value generator name
|
* @return The identifier value generator name
|
||||||
*/
|
*/
|
||||||
public String getGeneratorName();
|
public String getGeneratorName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return The identifier generator configuration parameters
|
||||||
|
*/
|
||||||
|
public Map<String, String> getParameters();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue