Finalize moving annotations tests and ensure columns are sorted also for collection keys properly
This commit is contained in:
parent
1ede36212b
commit
fb882f56f3
|
@ -183,7 +183,7 @@ public class InferredBasicValueResolver {
|
||||||
);
|
);
|
||||||
legacyType = jdbcMapping;
|
legacyType = jdbcMapping;
|
||||||
}
|
}
|
||||||
else if ( reflectedJtd instanceof SerializableJavaTypeDescriptor || reflectedJtd.getJavaType() instanceof Serializable ) {
|
else if ( reflectedJtd instanceof SerializableJavaTypeDescriptor || Serializable.class.isAssignableFrom( reflectedJtd.getJavaTypeClass() ) ) {
|
||||||
legacyType = new SerializableType<>( reflectedJtd );
|
legacyType = new SerializableType<>( reflectedJtd );
|
||||||
jdbcMapping = legacyType;
|
jdbcMapping = legacyType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,7 @@ import org.hibernate.mapping.Selectable;
|
||||||
import org.hibernate.mapping.Set;
|
import org.hibernate.mapping.Set;
|
||||||
import org.hibernate.mapping.SimpleValue;
|
import org.hibernate.mapping.SimpleValue;
|
||||||
import org.hibernate.mapping.SingleTableSubclass;
|
import org.hibernate.mapping.SingleTableSubclass;
|
||||||
|
import org.hibernate.mapping.SortableValue;
|
||||||
import org.hibernate.mapping.SyntheticProperty;
|
import org.hibernate.mapping.SyntheticProperty;
|
||||||
import org.hibernate.mapping.Table;
|
import org.hibernate.mapping.Table;
|
||||||
import org.hibernate.mapping.UnionSubclass;
|
import org.hibernate.mapping.UnionSubclass;
|
||||||
|
@ -275,6 +276,9 @@ public class ModelBinder {
|
||||||
|
|
||||||
applyCaching( mappingDocument, hierarchySource.getCaching(), rootEntityDescriptor );
|
applyCaching( mappingDocument, hierarchySource.getCaching(), rootEntityDescriptor );
|
||||||
|
|
||||||
|
if ( rootEntityDescriptor.getIdentifier() instanceof SortableValue ) {
|
||||||
|
( (SortableValue) rootEntityDescriptor.getIdentifier() ).sortProperties();
|
||||||
|
}
|
||||||
// Primary key constraint
|
// Primary key constraint
|
||||||
rootEntityDescriptor.createPrimaryKey();
|
rootEntityDescriptor.createPrimaryKey();
|
||||||
|
|
||||||
|
@ -606,7 +610,7 @@ public class ModelBinder {
|
||||||
}
|
}
|
||||||
|
|
||||||
// KEY
|
// KEY
|
||||||
final SimpleValue keyBinding = new DependantValue(
|
final DependantValue keyBinding = new DependantValue(
|
||||||
mappingDocument,
|
mappingDocument,
|
||||||
primaryTable,
|
primaryTable,
|
||||||
entityDescriptor.getIdentifier()
|
entityDescriptor.getIdentifier()
|
||||||
|
@ -618,7 +622,7 @@ public class ModelBinder {
|
||||||
keyBinding.setCascadeDeleteEnabled( entitySource.isCascadeDeleteEnabled() );
|
keyBinding.setCascadeDeleteEnabled( entitySource.isCascadeDeleteEnabled() );
|
||||||
relationalObjectBinder.bindColumns(
|
relationalObjectBinder.bindColumns(
|
||||||
mappingDocument,
|
mappingDocument,
|
||||||
sortColumns( entitySource.getPrimaryKeyColumnSources(), entityDescriptor.getIdentifier() ),
|
entitySource.getPrimaryKeyColumnSources(),
|
||||||
keyBinding,
|
keyBinding,
|
||||||
false,
|
false,
|
||||||
new RelationalObjectBinder.ColumnNamingDelegate() {
|
new RelationalObjectBinder.ColumnNamingDelegate() {
|
||||||
|
@ -630,6 +634,7 @@ public class ModelBinder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
keyBinding.sortProperties();
|
||||||
keyBinding.setForeignKeyName( entitySource.getExplicitForeignKeyName() );
|
keyBinding.setForeignKeyName( entitySource.getExplicitForeignKeyName() );
|
||||||
// model.getKey().setType( new Type( model.getIdentifier() ) );
|
// model.getKey().setType( new Type( model.getIdentifier() ) );
|
||||||
entityDescriptor.createPrimaryKey();
|
entityDescriptor.createPrimaryKey();
|
||||||
|
@ -1786,7 +1791,7 @@ public class ModelBinder {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final SimpleValue keyBinding = new DependantValue(
|
final DependantValue keyBinding = new DependantValue(
|
||||||
mappingDocument,
|
mappingDocument,
|
||||||
secondaryTable,
|
secondaryTable,
|
||||||
persistentClass.getIdentifier()
|
persistentClass.getIdentifier()
|
||||||
|
@ -1802,7 +1807,7 @@ public class ModelBinder {
|
||||||
|
|
||||||
relationalObjectBinder.bindColumns(
|
relationalObjectBinder.bindColumns(
|
||||||
mappingDocument,
|
mappingDocument,
|
||||||
sortColumns( secondaryTableSource.getPrimaryKeyColumnSources(), persistentClass.getIdentifier() ),
|
secondaryTableSource.getPrimaryKeyColumnSources(),
|
||||||
keyBinding,
|
keyBinding,
|
||||||
secondaryTableSource.isOptional(),
|
secondaryTableSource.isOptional(),
|
||||||
new RelationalObjectBinder.ColumnNamingDelegate() {
|
new RelationalObjectBinder.ColumnNamingDelegate() {
|
||||||
|
@ -1815,6 +1820,7 @@ public class ModelBinder {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
keyBinding.sortProperties();
|
||||||
keyBinding.setForeignKeyName( secondaryTableSource.getExplicitForeignKeyName() );
|
keyBinding.setForeignKeyName( secondaryTableSource.getExplicitForeignKeyName() );
|
||||||
|
|
||||||
// skip creating primary and foreign keys for a subselect.
|
// skip creating primary and foreign keys for a subselect.
|
||||||
|
@ -3432,6 +3438,7 @@ public class ModelBinder {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
key.sortProperties();
|
||||||
key.createForeignKey();
|
key.createForeignKey();
|
||||||
getCollectionBinding().setKey( key );
|
getCollectionBinding().setKey( key );
|
||||||
|
|
||||||
|
|
|
@ -699,7 +699,7 @@ public final class AnnotationBinder {
|
||||||
if ( inheritanceState.hasParents() ) {
|
if ( inheritanceState.hasParents() ) {
|
||||||
onDeleteAppropriate = true;
|
onDeleteAppropriate = true;
|
||||||
final JoinedSubclass jsc = ( JoinedSubclass ) persistentClass;
|
final JoinedSubclass jsc = ( JoinedSubclass ) persistentClass;
|
||||||
SimpleValue key = new DependantValue( context, jsc.getTable(), jsc.getIdentifier() );
|
DependantValue key = new DependantValue( context, jsc.getTable(), jsc.getIdentifier() );
|
||||||
jsc.setKey( key );
|
jsc.setKey( key );
|
||||||
ForeignKey fk = clazzToProcess.getAnnotation( ForeignKey.class );
|
ForeignKey fk = clazzToProcess.getAnnotation( ForeignKey.class );
|
||||||
if ( fk != null && !BinderHelper.isEmptyAnnotationValue( fk.name() ) ) {
|
if ( fk != null && !BinderHelper.isEmptyAnnotationValue( fk.name() ) ) {
|
||||||
|
|
|
@ -156,6 +156,7 @@ public class BinderHelper {
|
||||||
clone.setValueGenerationStrategy( property.getValueGenerationStrategy() );
|
clone.setValueGenerationStrategy( property.getValueGenerationStrategy() );
|
||||||
embeddedComp.addProperty( clone );
|
embeddedComp.addProperty( clone );
|
||||||
}
|
}
|
||||||
|
embeddedComp.sortProperties();
|
||||||
synthProp = new SyntheticProperty();
|
synthProp = new SyntheticProperty();
|
||||||
synthProp.setName( syntheticPropertyName );
|
synthProp.setName( syntheticPropertyName );
|
||||||
synthProp.setPersistentClass( ownerEntity );
|
synthProp.setPersistentClass( ownerEntity );
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.hibernate.mapping.OneToOne;
|
||||||
import org.hibernate.mapping.PersistentClass;
|
import org.hibernate.mapping.PersistentClass;
|
||||||
import org.hibernate.mapping.Property;
|
import org.hibernate.mapping.Property;
|
||||||
import org.hibernate.mapping.SimpleValue;
|
import org.hibernate.mapping.SimpleValue;
|
||||||
|
import org.hibernate.mapping.SortableValue;
|
||||||
import org.hibernate.type.ForeignKeyDirection;
|
import org.hibernate.type.ForeignKeyDirection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -258,6 +259,7 @@ public class OneToOneSecondPass implements SecondPass {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
value.sortProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -278,7 +280,7 @@ public class OneToOneSecondPass implements SecondPass {
|
||||||
//no check constraints available on joins
|
//no check constraints available on joins
|
||||||
join.setTable( originalJoin.getTable() );
|
join.setTable( originalJoin.getTable() );
|
||||||
join.setInverse( true );
|
join.setInverse( true );
|
||||||
SimpleValue key = new DependantValue( buildingContext, join.getTable(), persistentClass.getIdentifier() );
|
DependantValue key = new DependantValue( buildingContext, join.getTable(), persistentClass.getIdentifier() );
|
||||||
//TODO support @ForeignKey
|
//TODO support @ForeignKey
|
||||||
join.setKey( key );
|
join.setKey( key );
|
||||||
join.setSequentialSelect( false );
|
join.setSequentialSelect( false );
|
||||||
|
@ -303,6 +305,10 @@ public class OneToOneSecondPass implements SecondPass {
|
||||||
column.setGeneratedAs( column.getGeneratedAs() );
|
column.setGeneratedAs( column.getGeneratedAs() );
|
||||||
key.addColumn( copy );
|
key.addColumn( copy );
|
||||||
}
|
}
|
||||||
|
if ( otherSideProperty.getValue() instanceof SortableValue
|
||||||
|
&& !( (SortableValue) otherSideProperty.getValue() ).isSorted() ) {
|
||||||
|
key.sortProperties();
|
||||||
|
}
|
||||||
persistentClass.addJoin( join );
|
persistentClass.addJoin( join );
|
||||||
return join;
|
return join;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1264,6 +1264,13 @@ public class BasicValueBinder<T> implements JdbcTypeDescriptorIndicators {
|
||||||
public void fillSimpleValue() {
|
public void fillSimpleValue() {
|
||||||
LOG.debugf( "Starting `BasicValueBinder#fillSimpleValue` for %s", propertyName );
|
LOG.debugf( "Starting `BasicValueBinder#fillSimpleValue` for %s", propertyName );
|
||||||
|
|
||||||
|
final String explicitBasicTypeName;
|
||||||
|
if ( this.explicitBasicTypeName != null ) {
|
||||||
|
explicitBasicTypeName = this.explicitBasicTypeName;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
explicitBasicTypeName = this.timeStampVersionType;
|
||||||
|
}
|
||||||
basicValue.setExplicitTypeName( explicitBasicTypeName );
|
basicValue.setExplicitTypeName( explicitBasicTypeName );
|
||||||
basicValue.setExplicitTypeParams( explicitLocalTypeParams );
|
basicValue.setExplicitTypeParams( explicitLocalTypeParams );
|
||||||
|
|
||||||
|
|
|
@ -1387,7 +1387,7 @@ public abstract class CollectionBinder {
|
||||||
return orderByFragment;
|
return orderByFragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SimpleValue buildCollectionKey(
|
private static DependantValue buildCollectionKey(
|
||||||
Collection collValue,
|
Collection collValue,
|
||||||
AnnotatedJoinColumn[] joinColumns,
|
AnnotatedJoinColumn[] joinColumns,
|
||||||
boolean cascadeDeleteEnabled,
|
boolean cascadeDeleteEnabled,
|
||||||
|
@ -1976,12 +1976,13 @@ public abstract class CollectionBinder {
|
||||||
catch (AnnotationException ex) {
|
catch (AnnotationException ex) {
|
||||||
throw new AnnotationException( "Unable to map collection " + collValue.getOwner().getClassName() + "." + property.getName(), ex );
|
throw new AnnotationException( "Unable to map collection " + collValue.getOwner().getClassName() + "." + property.getName(), ex );
|
||||||
}
|
}
|
||||||
SimpleValue key = buildCollectionKey( collValue, joinColumns, cascadeDeleteEnabled,
|
DependantValue key = buildCollectionKey( collValue, joinColumns, cascadeDeleteEnabled,
|
||||||
buildingContext.getBuildingOptions().isNoConstraintByDefault(), property, propertyHolder, buildingContext );
|
buildingContext.getBuildingOptions().isNoConstraintByDefault(), property, propertyHolder, buildingContext );
|
||||||
if ( property.isAnnotationPresent( ElementCollection.class ) && joinColumns.length > 0 ) {
|
if ( property.isAnnotationPresent( ElementCollection.class ) && joinColumns.length > 0 ) {
|
||||||
joinColumns[0].setJPA2ElementCollection( true );
|
joinColumns[0].setJPA2ElementCollection( true );
|
||||||
}
|
}
|
||||||
TableBinder.bindFk( collValue.getOwner(), collectionEntity, joinColumns, key, false, buildingContext );
|
TableBinder.bindFk( collValue.getOwner(), collectionEntity, joinColumns, key, false, buildingContext );
|
||||||
|
key.sortProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCascadeDeleteEnabled(boolean onDeleteCascade) {
|
public void setCascadeDeleteEnabled(boolean onDeleteCascade) {
|
||||||
|
|
|
@ -926,11 +926,12 @@ public class EntityBinder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindJoinToPersistentClass(Join join, AnnotatedJoinColumn[] annotatedJoinColumns, MetadataBuildingContext buildingContext) {
|
private void bindJoinToPersistentClass(Join join, AnnotatedJoinColumn[] annotatedJoinColumns, MetadataBuildingContext buildingContext) {
|
||||||
SimpleValue key = new DependantValue( buildingContext, join.getTable(), persistentClass.getIdentifier() );
|
DependantValue key = new DependantValue( buildingContext, join.getTable(), persistentClass.getIdentifier() );
|
||||||
join.setKey( key );
|
join.setKey( key );
|
||||||
setFKNameIfDefined( join );
|
setFKNameIfDefined( join );
|
||||||
key.setCascadeDeleteEnabled( false );
|
key.setCascadeDeleteEnabled( false );
|
||||||
TableBinder.bindFk( persistentClass, null, annotatedJoinColumns, key, false, buildingContext );
|
TableBinder.bindFk( persistentClass, null, annotatedJoinColumns, key, false, buildingContext );
|
||||||
|
key.sortProperties();
|
||||||
join.createPrimaryKey();
|
join.createPrimaryKey();
|
||||||
join.createForeignKey();
|
join.createForeignKey();
|
||||||
persistentClass.addJoin( join );
|
persistentClass.addJoin( join );
|
||||||
|
|
|
@ -40,6 +40,7 @@ import org.hibernate.mapping.JoinedSubclass;
|
||||||
import org.hibernate.mapping.PersistentClass;
|
import org.hibernate.mapping.PersistentClass;
|
||||||
import org.hibernate.mapping.Property;
|
import org.hibernate.mapping.Property;
|
||||||
import org.hibernate.mapping.SimpleValue;
|
import org.hibernate.mapping.SimpleValue;
|
||||||
|
import org.hibernate.mapping.SortableValue;
|
||||||
import org.hibernate.mapping.Table;
|
import org.hibernate.mapping.Table;
|
||||||
import org.hibernate.mapping.ToOne;
|
import org.hibernate.mapping.ToOne;
|
||||||
import org.hibernate.mapping.Value;
|
import org.hibernate.mapping.Value;
|
||||||
|
@ -636,7 +637,9 @@ public class TableBinder {
|
||||||
linkJoinColumnWithValueOverridingNameIfImplicit(
|
linkJoinColumnWithValueOverridingNameIfImplicit(
|
||||||
referencedEntity, synthProp.getColumnIterator(), columns, value
|
referencedEntity, synthProp.getColumnIterator(), columns, value
|
||||||
);
|
);
|
||||||
|
if ( value instanceof SortableValue ) {
|
||||||
|
( (SortableValue) value ).sortProperties();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( AnnotatedJoinColumn.NO_REFERENCE == fkEnum ) {
|
if ( AnnotatedJoinColumn.NO_REFERENCE == fkEnum ) {
|
||||||
|
@ -655,6 +658,9 @@ public class TableBinder {
|
||||||
columns,
|
columns,
|
||||||
value
|
value
|
||||||
);
|
);
|
||||||
|
if ( value instanceof SortableValue ) {
|
||||||
|
( (SortableValue) value ).sortProperties();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Ensure the component is sorted so that we can simply set sorted to true on the to-one
|
// Ensure the component is sorted so that we can simply set sorted to true on the to-one
|
||||||
|
|
|
@ -40,7 +40,7 @@ import org.hibernate.type.Type;
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class Component extends SimpleValue implements MetaAttributable {
|
public class Component extends SimpleValue implements MetaAttributable, SortableValue {
|
||||||
private ArrayList<Property> properties = new ArrayList<>();
|
private ArrayList<Property> properties = new ArrayList<>();
|
||||||
private int[] originalPropertyOrder = ArrayHelper.EMPTY_INT_ARRAY;
|
private int[] originalPropertyOrder = ArrayHelper.EMPTY_INT_ARRAY;
|
||||||
private String componentClassName;
|
private String componentClassName;
|
||||||
|
@ -504,6 +504,12 @@ public class Component extends SimpleValue implements MetaAttributable {
|
||||||
getType();
|
getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSorted() {
|
||||||
|
return originalPropertyOrder != ArrayHelper.EMPTY_INT_ARRAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int[] sortProperties() {
|
public int[] sortProperties() {
|
||||||
return sortProperties( false );
|
return sortProperties( false );
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,11 @@ import org.hibernate.type.Type;
|
||||||
*
|
*
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
public class DependantValue extends SimpleValue implements Resolvable {
|
public class DependantValue extends SimpleValue implements Resolvable, SortableValue {
|
||||||
private KeyValue wrappedValue;
|
private KeyValue wrappedValue;
|
||||||
private boolean nullable;
|
private boolean nullable;
|
||||||
private boolean updateable;
|
private boolean updateable;
|
||||||
|
private boolean sorted;
|
||||||
|
|
||||||
public DependantValue(MetadataBuildingContext buildingContext, Table table, KeyValue prototype) {
|
public DependantValue(MetadataBuildingContext buildingContext, Table table, KeyValue prototype) {
|
||||||
super( buildingContext, table );
|
super( buildingContext, table );
|
||||||
|
@ -87,4 +88,26 @@ public class DependantValue extends SimpleValue implements Resolvable {
|
||||||
throw new UnsupportedOperationException("Trying to resolve the wrapped value but it is non a BasicValue");
|
throw new UnsupportedOperationException("Trying to resolve the wrapped value but it is non a BasicValue");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSorted() {
|
||||||
|
return sorted;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSorted(boolean sorted) {
|
||||||
|
this.sorted = sorted;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] sortProperties() {
|
||||||
|
if ( !sorted ) {
|
||||||
|
sorted = true;
|
||||||
|
if ( wrappedValue instanceof SortableValue ) {
|
||||||
|
final int[] originalOrder = ( (SortableValue) wrappedValue ).sortProperties();
|
||||||
|
if ( originalOrder != null ) {
|
||||||
|
sortColumns( originalOrder );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,7 @@ public class OneToOne extends ToOne {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void createForeignKey() throws MappingException {
|
public void createForeignKey() throws MappingException {
|
||||||
// Ensure properties are sorted before we create a foreign key
|
// Ensure properties are sorted before we create a foreign key
|
||||||
sortProperties();
|
sortProperties();
|
||||||
|
|
|
@ -169,7 +169,7 @@ public abstract class SimpleValue implements KeyValue {
|
||||||
updatability.add( false );
|
updatability.add( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sortColumns(int[] originalOrder) {
|
public void sortColumns(int[] originalOrder) {
|
||||||
final Selectable[] originalColumns = columns.toArray(new Selectable[0]);
|
final Selectable[] originalColumns = columns.toArray(new Selectable[0]);
|
||||||
final boolean[] originalInsertability = ArrayHelper.toBooleanArray( insertability );
|
final boolean[] originalInsertability = ArrayHelper.toBooleanArray( insertability );
|
||||||
final boolean[] originalUpdatability = ArrayHelper.toBooleanArray( updatability );
|
final boolean[] originalUpdatability = ArrayHelper.toBooleanArray( updatability );
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
|
||||||
|
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
|
||||||
|
*/
|
||||||
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface SortableValue {
|
||||||
|
|
||||||
|
boolean isSorted();
|
||||||
|
|
||||||
|
int[] sortProperties();
|
||||||
|
}
|
|
@ -21,7 +21,7 @@ import java.util.Objects;
|
||||||
* A simple-point association (ie. a reference to another entity).
|
* A simple-point association (ie. a reference to another entity).
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
public abstract class ToOne extends SimpleValue implements Fetchable {
|
public abstract class ToOne extends SimpleValue implements Fetchable, SortableValue {
|
||||||
private FetchMode fetchMode;
|
private FetchMode fetchMode;
|
||||||
protected String referencedPropertyName;
|
protected String referencedPropertyName;
|
||||||
private String referencedEntityName;
|
private String referencedEntityName;
|
||||||
|
@ -145,6 +145,7 @@ public abstract class ToOne extends SimpleValue implements Fetchable {
|
||||||
this.referenceToPrimaryKey = referenceToPrimaryKey;
|
this.referenceToPrimaryKey = referenceToPrimaryKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isSorted() {
|
public boolean isSorted() {
|
||||||
return sorted;
|
return sorted;
|
||||||
}
|
}
|
||||||
|
@ -153,11 +154,8 @@ public abstract class ToOne extends SimpleValue implements Fetchable {
|
||||||
this.sorted = sorted;
|
this.sorted = sorted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sortProperties() {
|
@Override
|
||||||
if ( sorted ) {
|
public int[] sortProperties() {
|
||||||
return;
|
|
||||||
}
|
|
||||||
sorted = true;
|
|
||||||
final PersistentClass entityBinding = getMetadata().getEntityBinding( getReferencedEntityName() );
|
final PersistentClass entityBinding = getMetadata().getEntityBinding( getReferencedEntityName() );
|
||||||
final Value value;
|
final Value value;
|
||||||
if ( getReferencedPropertyName() == null ) {
|
if ( getReferencedPropertyName() == null ) {
|
||||||
|
@ -169,9 +167,15 @@ public abstract class ToOne extends SimpleValue implements Fetchable {
|
||||||
if ( value instanceof Component ) {
|
if ( value instanceof Component ) {
|
||||||
final Component component = (Component) value;
|
final Component component = (Component) value;
|
||||||
final int[] originalPropertyOrder = component.sortProperties();
|
final int[] originalPropertyOrder = component.sortProperties();
|
||||||
if ( originalPropertyOrder != null ) {
|
if ( !sorted ) {
|
||||||
sortColumns( originalPropertyOrder );
|
sorted = true;
|
||||||
|
if ( originalPropertyOrder != null ) {
|
||||||
|
sortColumns( originalPropertyOrder );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return originalPropertyOrder;
|
||||||
}
|
}
|
||||||
|
sorted = true;
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ import org.hibernate.mapping.Property;
|
||||||
import org.hibernate.mapping.Resolvable;
|
import org.hibernate.mapping.Resolvable;
|
||||||
import org.hibernate.mapping.Selectable;
|
import org.hibernate.mapping.Selectable;
|
||||||
import org.hibernate.mapping.SimpleValue;
|
import org.hibernate.mapping.SimpleValue;
|
||||||
|
import org.hibernate.mapping.SortableValue;
|
||||||
import org.hibernate.mapping.Table;
|
import org.hibernate.mapping.Table;
|
||||||
import org.hibernate.mapping.ToOne;
|
import org.hibernate.mapping.ToOne;
|
||||||
import org.hibernate.mapping.Value;
|
import org.hibernate.mapping.Value;
|
||||||
|
@ -1011,7 +1012,11 @@ public class MappingModelCreationHelper {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
declaringKeyPart = simpleFkTarget;
|
declaringKeyPart = simpleFkTarget;
|
||||||
declaringKeyPropertyAccess = ( (PropertyBasedMapping) declaringKeyPart ).getPropertyAccess();
|
// declaringKeyPropertyAccess = ( (PropertyBasedMapping) declaringKeyPart ).getPropertyAccess();
|
||||||
|
declaringKeyPropertyAccess = new ChainedPropertyAccessImpl(
|
||||||
|
attributeMapping.getPropertyAccess(),
|
||||||
|
( (PropertyBasedMapping) declaringKeyPart ).getPropertyAccess()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1220,7 +1225,8 @@ public class MappingModelCreationHelper {
|
||||||
if ( bootValueMapping instanceof Collection ) {
|
if ( bootValueMapping instanceof Collection ) {
|
||||||
final Collection collectionBootValueMapping = (Collection) bootValueMapping;
|
final Collection collectionBootValueMapping = (Collection) bootValueMapping;
|
||||||
componentType = (ComponentType) collectionBootValueMapping.getKey().getType();
|
componentType = (ComponentType) collectionBootValueMapping.getKey().getType();
|
||||||
sorted = false;
|
assert ( (SortableValue) collectionBootValueMapping.getKey() ).isSorted();
|
||||||
|
sorted = ( (SortableValue) collectionBootValueMapping.getKey() ).isSorted();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final EntityType entityType = (EntityType) bootValueMapping.getType();
|
final EntityType entityType = (EntityType) bootValueMapping.getType();
|
||||||
|
@ -1230,6 +1236,7 @@ public class MappingModelCreationHelper {
|
||||||
if ( identifierOrUniqueKeyType instanceof ComponentType ) {
|
if ( identifierOrUniqueKeyType instanceof ComponentType ) {
|
||||||
componentType = (ComponentType) identifierOrUniqueKeyType;
|
componentType = (ComponentType) identifierOrUniqueKeyType;
|
||||||
if ( bootValueMapping instanceof ToOne ) {
|
if ( bootValueMapping instanceof ToOne ) {
|
||||||
|
assert ( (ToOne) bootValueMapping ).isSorted();
|
||||||
sorted = ( (ToOne) bootValueMapping ).isSorted();
|
sorted = ( (ToOne) bootValueMapping ).isSorted();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -1193,7 +1193,7 @@ public final class StandardBasicTypes {
|
||||||
DbTimestampType.INSTANCE,
|
DbTimestampType.INSTANCE,
|
||||||
null,
|
null,
|
||||||
basicTypeRegistry,
|
basicTypeRegistry,
|
||||||
DbTimestampType.INSTANCE.getName()
|
DbTimestampType.INSTANCE.getName(), "dbtimestamp"
|
||||||
);
|
);
|
||||||
|
|
||||||
handle(
|
handle(
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations;
|
package org.hibernate.orm.test.annotations;
|
||||||
import jakarta.persistence.DiscriminatorValue;
|
import jakarta.persistence.DiscriminatorValue;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations;
|
package org.hibernate.orm.test.annotations;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations;
|
package org.hibernate.orm.test.annotations;
|
||||||
import org.hibernate.cfg.PersistenceStandardNamingStrategy;
|
import org.hibernate.cfg.PersistenceStandardNamingStrategy;
|
||||||
import org.hibernate.cfg.NamingStrategy;
|
import org.hibernate.cfg.NamingStrategy;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations;
|
package org.hibernate.orm.test.annotations;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.JoinColumn;
|
import jakarta.persistence.JoinColumn;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations;
|
package org.hibernate.orm.test.annotations;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
|
@ -17,9 +17,6 @@ import org.hibernate.cfg.Environment;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
|
|
||||||
import org.hibernate.query.sqm.UnknownEntityException;
|
import org.hibernate.query.sqm.UnknownEntityException;
|
||||||
import org.hibernate.test.annotations.Boat;
|
|
||||||
import org.hibernate.test.annotations.Ferry;
|
|
||||||
import org.hibernate.test.annotations.Port;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.hibernate.testing.transaction.TransactionUtil2.inTransaction;
|
import static org.hibernate.testing.transaction.TransactionUtil2.inTransaction;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations;
|
package org.hibernate.orm.test.annotations;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations;
|
package org.hibernate.orm.test.annotations;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations;
|
package org.hibernate.orm.test.annotations;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import jakarta.persistence.CascadeType;
|
import jakarta.persistence.CascadeType;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations;
|
package org.hibernate.orm.test.annotations;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations;
|
package org.hibernate.orm.test.annotations;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.MappedSuperclass;
|
import jakarta.persistence.MappedSuperclass;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations;
|
package org.hibernate.orm.test.annotations;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -15,10 +15,6 @@ import org.hibernate.orm.test.annotations.inheritance.Tomato;
|
||||||
import org.hibernate.orm.test.annotations.inheritance.Vegetable;
|
import org.hibernate.orm.test.annotations.inheritance.Vegetable;
|
||||||
import org.hibernate.orm.test.annotations.inheritance.VegetablePk;
|
import org.hibernate.orm.test.annotations.inheritance.VegetablePk;
|
||||||
|
|
||||||
import org.hibernate.test.annotations.AmericaCupClass;
|
|
||||||
import org.hibernate.test.annotations.Boat;
|
|
||||||
import org.hibernate.test.annotations.Country;
|
|
||||||
import org.hibernate.test.annotations.Ferry;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations;
|
package org.hibernate.orm.test.annotations;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations;
|
package org.hibernate.orm.test.annotations;
|
||||||
import jakarta.persistence.AttributeOverride;
|
import jakarta.persistence.AttributeOverride;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.DiscriminatorColumn;
|
import jakarta.persistence.DiscriminatorColumn;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations;
|
package org.hibernate.orm.test.annotations;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
|
@ -16,8 +16,6 @@ import org.hibernate.cfg.Environment;
|
||||||
import org.hibernate.service.ServiceRegistry;
|
import org.hibernate.service.ServiceRegistry;
|
||||||
import org.hibernate.testing.ServiceRegistryBuilder;
|
import org.hibernate.testing.ServiceRegistryBuilder;
|
||||||
|
|
||||||
import org.hibernate.test.annotations.IncorrectEntity;
|
|
||||||
|
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.hibernate.cfg.Environment;
|
||||||
import org.hibernate.service.ServiceRegistry;
|
import org.hibernate.service.ServiceRegistry;
|
||||||
|
|
||||||
import org.hibernate.testing.ServiceRegistryBuilder;
|
import org.hibernate.testing.ServiceRegistryBuilder;
|
||||||
import org.hibernate.test.annotations.Plane;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations;
|
package org.hibernate.orm.test.annotations;
|
||||||
import jakarta.persistence.MappedSuperclass;
|
import jakarta.persistence.MappedSuperclass;
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations;
|
package org.hibernate.orm.test.annotations;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations;
|
package org.hibernate.orm.test.annotations;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -11,7 +11,7 @@ import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Embeddable;
|
import jakarta.persistence.Embeddable;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
|
|
||||||
import org.hibernate.test.annotations.Country;
|
import org.hibernate.orm.test.annotations.Country;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.hibernate.testing.orm.junit.ServiceRegistry;
|
||||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||||
import org.hibernate.testing.orm.junit.Setting;
|
import org.hibernate.testing.orm.junit.Setting;
|
||||||
import org.hibernate.test.annotations.Country;
|
import org.hibernate.orm.test.annotations.Country;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
|
@ -20,9 +20,9 @@ import org.hibernate.query.Query;
|
||||||
import org.hibernate.testing.orm.junit.DomainModel;
|
import org.hibernate.testing.orm.junit.DomainModel;
|
||||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||||
import org.hibernate.test.annotations.A320;
|
import org.hibernate.orm.test.annotations.A320;
|
||||||
import org.hibernate.test.annotations.A320b;
|
import org.hibernate.orm.test.annotations.A320b;
|
||||||
import org.hibernate.test.annotations.Plane;
|
import org.hibernate.orm.test.annotations.Plane;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,11 @@ import org.hibernate.cfg.Configuration;
|
||||||
|
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
import org.hibernate.orm.test.annotations.Company;
|
import org.hibernate.orm.test.annotations.Company;
|
||||||
import org.hibernate.test.annotations.Customer;
|
import org.hibernate.orm.test.annotations.Customer;
|
||||||
import org.hibernate.test.annotations.Discount;
|
import org.hibernate.orm.test.annotations.Discount;
|
||||||
import org.hibernate.orm.test.annotations.Flight;
|
import org.hibernate.orm.test.annotations.Flight;
|
||||||
import org.hibernate.test.annotations.Passport;
|
import org.hibernate.orm.test.annotations.Passport;
|
||||||
import org.hibernate.test.annotations.Ticket;
|
import org.hibernate.orm.test.annotations.Ticket;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hibernate.test.annotations.manytoonewithformula;
|
package org.hibernate.orm.test.annotations.manytoonewithformula;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
|
@ -5,7 +5,7 @@
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hibernate.test.annotations.manytoonewithformula;
|
package org.hibernate.orm.test.annotations.manytoonewithformula;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
|
@ -5,7 +5,7 @@
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hibernate.test.annotations.manytoonewithformula;
|
package org.hibernate.orm.test.annotations.manytoonewithformula;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Embeddable;
|
import jakarta.persistence.Embeddable;
|
|
@ -5,7 +5,7 @@
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hibernate.test.annotations.manytoonewithformula;
|
package org.hibernate.orm.test.annotations.manytoonewithformula;
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
|
@ -5,7 +5,7 @@
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hibernate.test.annotations.manytoonewithformula;
|
package org.hibernate.orm.test.annotations.manytoonewithformula;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
|
@ -5,7 +5,7 @@
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hibernate.test.annotations.manytoonewithformula;
|
package org.hibernate.orm.test.annotations.manytoonewithformula;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
|
@ -5,7 +5,7 @@
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hibernate.test.annotations.manytoonewithformula;
|
package org.hibernate.orm.test.annotations.manytoonewithformula;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Embeddable;
|
import jakarta.persistence.Embeddable;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.manytoonewithformula;
|
package org.hibernate.orm.test.annotations.manytoonewithformula;
|
||||||
|
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.Transaction;
|
import org.hibernate.Transaction;
|
|
@ -5,7 +5,7 @@
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hibernate.test.annotations.manytoonewithformula;
|
package org.hibernate.orm.test.annotations.manytoonewithformula;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package org.hibernate.test.annotations.manytoonewithformula;
|
package org.hibernate.orm.test.annotations.manytoonewithformula;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
|
@ -5,7 +5,7 @@
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hibernate.test.annotations.manytoonewithformula;
|
package org.hibernate.orm.test.annotations.manytoonewithformula;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
|
@ -5,7 +5,7 @@
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hibernate.test.annotations.manytoonewithformula;
|
package org.hibernate.orm.test.annotations.manytoonewithformula;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Embeddable;
|
import jakarta.persistence.Embeddable;
|
|
@ -5,7 +5,7 @@
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hibernate.test.annotations.manytoonewithformula;
|
package org.hibernate.orm.test.annotations.manytoonewithformula;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
|
@ -5,7 +5,7 @@
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hibernate.test.annotations.manytoonewithformula;
|
package org.hibernate.orm.test.annotations.manytoonewithformula;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
|
@ -5,7 +5,7 @@
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.hibernate.test.annotations.manytoonewithformula;
|
package org.hibernate.orm.test.annotations.manytoonewithformula;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
|
@ -43,11 +43,11 @@ import org.hibernate.testing.DialectChecks;
|
||||||
import org.hibernate.testing.RequiresDialectFeature;
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
|
||||||
import org.hibernate.test.annotations.Customer;
|
import org.hibernate.orm.test.annotations.Customer;
|
||||||
import org.hibernate.test.annotations.Discount;
|
import org.hibernate.orm.test.annotations.Discount;
|
||||||
import org.hibernate.test.annotations.Passport;
|
import org.hibernate.orm.test.annotations.Passport;
|
||||||
import org.hibernate.test.annotations.Ticket;
|
import org.hibernate.orm.test.annotations.Ticket;
|
||||||
import org.hibernate.test.annotations.TicketComparator;
|
import org.hibernate.orm.test.annotations.TicketComparator;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,10 @@ import org.hibernate.mapping.Table;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
|
||||||
import org.hibernate.testing.transaction.TransactionUtil;
|
import org.hibernate.testing.transaction.TransactionUtil;
|
||||||
import org.hibernate.test.annotations.Customer;
|
import org.hibernate.orm.test.annotations.Customer;
|
||||||
import org.hibernate.test.annotations.Discount;
|
import org.hibernate.orm.test.annotations.Discount;
|
||||||
import org.hibernate.test.annotations.Passport;
|
import org.hibernate.orm.test.annotations.Passport;
|
||||||
import org.hibernate.test.annotations.Ticket;
|
import org.hibernate.orm.test.annotations.Ticket;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.is;
|
import static org.hamcrest.CoreMatchers.is;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations.polymorphism;
|
package org.hibernate.orm.test.annotations.polymorphism;
|
||||||
|
|
||||||
public class Automobile {
|
public class Automobile {
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations.polymorphism;
|
package org.hibernate.orm.test.annotations.polymorphism;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.polymorphism;
|
package org.hibernate.orm.test.annotations.polymorphism;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.polymorphism;
|
package org.hibernate.orm.test.annotations.polymorphism;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -33,7 +33,8 @@ public class PolymorphismTest extends BaseCoreFunctionalTestCase {
|
||||||
s.persist( car2 );
|
s.persist( car2 );
|
||||||
s.flush();
|
s.flush();
|
||||||
assertEquals( 2, s.createQuery( "select car from Car car").list().size() );
|
assertEquals( 2, s.createQuery( "select car from Car car").list().size() );
|
||||||
assertEquals( 0, s.createQuery( "select count(m) from " + Automobile.class.getName() + " m").list().size() );
|
// Support for querying a type which has no entity subtypes was removed and now throws an error
|
||||||
|
// assertEquals( 0, s.createQuery( "select count(m) from " + Automobile.class.getName() + " m").list().size() );
|
||||||
tx.rollback();
|
tx.rollback();
|
||||||
s.close();
|
s.close();
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations.polymorphism;
|
package org.hibernate.orm.test.annotations.polymorphism;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
|
|
@ -35,9 +35,9 @@ import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||||
import org.hibernate.testing.orm.junit.Setting;
|
import org.hibernate.testing.orm.junit.Setting;
|
||||||
import org.hibernate.testing.orm.junit.SettingProvider;
|
import org.hibernate.testing.orm.junit.SettingProvider;
|
||||||
import org.hibernate.testing.orm.junit.SkipForDialect;
|
import org.hibernate.testing.orm.junit.SkipForDialect;
|
||||||
import org.hibernate.test.annotations.A320;
|
import org.hibernate.orm.test.annotations.A320;
|
||||||
import org.hibernate.test.annotations.A320b;
|
import org.hibernate.orm.test.annotations.A320b;
|
||||||
import org.hibernate.test.annotations.Plane;
|
import org.hibernate.orm.test.annotations.Plane;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations.referencedcolumnname;
|
package org.hibernate.orm.test.annotations.referencedcolumnname;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations.referencedcolumnname;
|
package org.hibernate.orm.test.annotations.referencedcolumnname;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations.referencedcolumnname;
|
package org.hibernate.orm.test.annotations.referencedcolumnname;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.referencedcolumnname;
|
package org.hibernate.orm.test.annotations.referencedcolumnname;
|
||||||
|
|
||||||
import jakarta.persistence.AssociationOverride;
|
import jakarta.persistence.AssociationOverride;
|
||||||
import jakarta.persistence.AssociationOverrides;
|
import jakarta.persistence.AssociationOverrides;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations.referencedcolumnname;
|
package org.hibernate.orm.test.annotations.referencedcolumnname;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations.referencedcolumnname;
|
package org.hibernate.orm.test.annotations.referencedcolumnname;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations.referencedcolumnname;
|
package org.hibernate.orm.test.annotations.referencedcolumnname;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations.referencedcolumnname;
|
package org.hibernate.orm.test.annotations.referencedcolumnname;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.referencedcolumnname;
|
package org.hibernate.orm.test.annotations.referencedcolumnname;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.referencedcolumnname;
|
package org.hibernate.orm.test.annotations.referencedcolumnname;
|
||||||
|
|
||||||
import jakarta.persistence.CascadeType;
|
import jakarta.persistence.CascadeType;
|
||||||
import jakarta.persistence.Embeddable;
|
import jakarta.persistence.Embeddable;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations.referencedcolumnname;
|
package org.hibernate.orm.test.annotations.referencedcolumnname;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations.referencedcolumnname;
|
package org.hibernate.orm.test.annotations.referencedcolumnname;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.referencedcolumnname;
|
package org.hibernate.orm.test.annotations.referencedcolumnname;
|
||||||
|
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.Transaction;
|
import org.hibernate.Transaction;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations.referencedcolumnname;
|
package org.hibernate.orm.test.annotations.referencedcolumnname;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations.referencedcolumnname;
|
package org.hibernate.orm.test.annotations.referencedcolumnname;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.Id;
|
import jakarta.persistence.Id;
|
|
@ -6,13 +6,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations.type;
|
package org.hibernate.orm.test.annotations.type;
|
||||||
|
import jakarta.persistence.AttributeOverride;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.EmbeddedId;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
||||||
import jakarta.persistence.Id;
|
|
||||||
|
|
||||||
import org.hibernate.annotations.Columns;
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,18 +23,13 @@ public class Dvd {
|
||||||
private MyOid id;
|
private MyOid id;
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@Id
|
@EmbeddedId
|
||||||
@GeneratedValue(generator = "custom-id")
|
@GeneratedValue(generator = "custom-id")
|
||||||
@GenericGenerator(name = "custom-id", strategy = "org.hibernate.test.annotations.type.MyOidGenerator")
|
@GenericGenerator(name = "custom-id", strategy = "org.hibernate.orm.test.annotations.type.MyOidGenerator")
|
||||||
// @Type(type = "org.hibernate.test.annotations.type.MyOidType")
|
@AttributeOverride(name = "aHigh", column = @Column(name = "high"))
|
||||||
@Columns(
|
@AttributeOverride(name = "aMiddle", column = @Column(name = "middle"))
|
||||||
columns = {
|
@AttributeOverride(name = "aLow", column = @Column(name = "low"))
|
||||||
@Column(name = "high"),
|
@AttributeOverride(name = "aOther", column = @Column(name = "other"))
|
||||||
@Column(name = "middle"),
|
|
||||||
@Column(name = "low"),
|
|
||||||
@Column(name = "other")
|
|
||||||
}
|
|
||||||
)
|
|
||||||
public MyOid getId() {
|
public MyOid getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//$Id$
|
||||||
|
package org.hibernate.orm.test.annotations.type;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import jakarta.persistence.Embeddable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Emmanuel Bernard
|
||||||
|
*/
|
||||||
|
@Embeddable
|
||||||
|
public class MyOid implements Serializable {
|
||||||
|
private int aHigh;
|
||||||
|
private int aMiddle;
|
||||||
|
private int aLow;
|
||||||
|
private int aOther;
|
||||||
|
|
||||||
|
protected MyOid() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyOid(int aHigh, int aMiddle, int aLow, int aOther) {
|
||||||
|
this.aHigh = aHigh;
|
||||||
|
this.aMiddle = aMiddle;
|
||||||
|
this.aLow = aLow;
|
||||||
|
this.aOther = aOther;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getaHigh() {
|
||||||
|
return aHigh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setaHigh(int aHigh) {
|
||||||
|
this.aHigh = aHigh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getaMiddle() {
|
||||||
|
return aMiddle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setaMiddle(int aMiddle) {
|
||||||
|
this.aMiddle = aMiddle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getaLow() {
|
||||||
|
return aLow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setaLow(int aLow) {
|
||||||
|
this.aLow = aLow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getaOther() {
|
||||||
|
return aOther;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setaOther(int aOther) {
|
||||||
|
this.aOther = aOther;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if ( this == o ) return true;
|
||||||
|
if ( o == null || getClass() != o.getClass() ) return false;
|
||||||
|
|
||||||
|
final MyOid myOid = (MyOid) o;
|
||||||
|
|
||||||
|
if ( aHigh != myOid.aHigh ) return false;
|
||||||
|
if ( aLow != myOid.aLow ) return false;
|
||||||
|
if ( aMiddle != myOid.aMiddle ) return false;
|
||||||
|
if ( aOther != myOid.aOther ) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hashCode() {
|
||||||
|
int result;
|
||||||
|
result = aLow;
|
||||||
|
result = 29 * result + aMiddle;
|
||||||
|
result = 29 * result + aHigh;
|
||||||
|
result = 29 * result + aOther;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//$Id$
|
//$Id$
|
||||||
package org.hibernate.test.annotations.type;
|
package org.hibernate.orm.test.annotations.type;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.type;
|
package org.hibernate.orm.test.annotations.type;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// $Id$
|
// $Id$
|
||||||
package org.hibernate.test.annotations.various;
|
package org.hibernate.orm.test.annotations.various;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.annotations.various;
|
package org.hibernate.orm.test.annotations.various;
|
||||||
|
|
||||||
import org.hibernate.boot.MetadataSources;
|
import org.hibernate.boot.MetadataSources;
|
||||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
import org.hibernate.boot.registry.StandardServiceRegistry;
|
|
@ -6,7 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// $Id$
|
// $Id$
|
||||||
package org.hibernate.test.annotations.various;
|
package org.hibernate.orm.test.annotations.various;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
import jakarta.persistence.GeneratedValue;
|
import jakarta.persistence.GeneratedValue;
|
|
@ -4,7 +4,7 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.bootstrap.binding.annotations.access.jpa;
|
package org.hibernate.orm.test.bootstrap.binding.annotations.access.jpa;
|
||||||
|
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
|
@ -1,85 +0,0 @@
|
||||||
/*
|
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
|
||||||
*
|
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//$Id$
|
|
||||||
package org.hibernate.test.annotations.type;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Emmanuel Bernard
|
|
||||||
*/
|
|
||||||
public class MyOid implements Serializable {
|
|
||||||
private int high;
|
|
||||||
private int middle;
|
|
||||||
private int low;
|
|
||||||
private int other;
|
|
||||||
|
|
||||||
protected MyOid() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public MyOid(int aHigh, int aMiddle, int aLow, int aOther) {
|
|
||||||
high = aHigh;
|
|
||||||
middle = aMiddle;
|
|
||||||
low = aLow;
|
|
||||||
other = aOther;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHigh() {
|
|
||||||
return high;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHigh(int aHigh) {
|
|
||||||
high = aHigh;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMiddle() {
|
|
||||||
return middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMiddle(int aMiddle) {
|
|
||||||
middle = aMiddle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLow() {
|
|
||||||
return low;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLow(int aLow) {
|
|
||||||
low = aLow;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getOther() {
|
|
||||||
return other;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOther(int aOther) {
|
|
||||||
other = aOther;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if ( this == o ) return true;
|
|
||||||
if ( o == null || getClass() != o.getClass() ) return false;
|
|
||||||
|
|
||||||
final MyOid myOid = (MyOid) o;
|
|
||||||
|
|
||||||
if ( high != myOid.high ) return false;
|
|
||||||
if ( low != myOid.low ) return false;
|
|
||||||
if ( middle != myOid.middle ) return false;
|
|
||||||
if ( other != myOid.other ) return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int hashCode() {
|
|
||||||
int result;
|
|
||||||
result = low;
|
|
||||||
result = 29 * result + middle;
|
|
||||||
result = 29 * result + high;
|
|
||||||
result = 29 * result + other;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<hibernate-mapping package="org.hibernate.test.annotations">
|
<hibernate-mapping package="org.hibernate.orm.test.annotations">
|
||||||
|
|
||||||
<class name="Boat" table="BoatInXml">
|
<class name="Boat" table="BoatInXml">
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<hibernate-mapping package="org.hibernate.test.annotations">
|
<hibernate-mapping package="org.hibernate.orm.test.annotations">
|
||||||
|
|
||||||
<joined-subclass name="Ferry" table="FerryJoined" extends="org.hibernate.test.annotations.Boat">
|
<joined-subclass name="Ferry" table="FerryJoined" extends="org.hibernate.orm.test.annotations.Boat">
|
||||||
<key column="id"/>
|
<key column="id"/>
|
||||||
<property name="sea"/>
|
<property name="sea"/>
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
|
|
||||||
<hibernate-configuration>
|
<hibernate-configuration>
|
||||||
<session-factory>
|
<session-factory>
|
||||||
<mapping resource="org/hibernate/test/annotations/Boat.hbm.xml"/>
|
<mapping resource="org/hibernate/orm/test/annotations/Boat.hbm.xml"/>
|
||||||
<mapping package="org.hibernate.test.annotations"/>
|
<mapping package="org.hibernate.orm.test.annotations"/>
|
||||||
<mapping class="org.hibernate.test.annotations.Plane"/>
|
<mapping class="org.hibernate.orm.test.annotations.Plane"/>
|
||||||
</session-factory>
|
</session-factory>
|
||||||
</hibernate-configuration>
|
</hibernate-configuration>
|
Loading…
Reference in New Issue