Move classloader, comments, connections, entityname, event, events, eviction, exception and fetch packages. Fix issues with key-many-to-one in collection key FK and implement cascade based fetching
This commit is contained in:
parent
c87a50ca0f
commit
181ac6e0ff
|
@ -22,6 +22,8 @@ import org.hibernate.collection.spi.BagSemantics;
|
|||
import org.hibernate.engine.FetchStyle;
|
||||
import org.hibernate.engine.FetchTiming;
|
||||
import org.hibernate.engine.profile.FetchProfile;
|
||||
import org.hibernate.engine.spi.CascadeStyle;
|
||||
import org.hibernate.engine.spi.CascadingAction;
|
||||
import org.hibernate.engine.spi.EffectiveEntityGraph;
|
||||
import org.hibernate.engine.spi.LoadQueryInfluencers;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
|
@ -32,6 +34,7 @@ import org.hibernate.internal.FilterHelper;
|
|||
import org.hibernate.loader.MultipleBagFetchException;
|
||||
import org.hibernate.loader.ast.spi.Loadable;
|
||||
import org.hibernate.loader.ast.spi.Loader;
|
||||
import org.hibernate.metamodel.mapping.AttributeMapping;
|
||||
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
||||
import org.hibernate.metamodel.mapping.CollectionPart;
|
||||
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
|
||||
|
@ -80,6 +83,7 @@ import org.hibernate.sql.results.graph.entity.EntityResultGraphNode;
|
|||
import org.hibernate.sql.results.graph.entity.EntityValuedFetchable;
|
||||
import org.hibernate.sql.results.internal.SqlSelectionImpl;
|
||||
import org.hibernate.sql.results.internal.StandardEntityGraphTraversalStateImpl;
|
||||
import org.hibernate.tuple.entity.EntityMetamodel;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
|
@ -248,6 +252,7 @@ public class LoaderSelectBuilder {
|
|||
|
||||
private int fetchDepth;
|
||||
private Map<OrderByFragment, TableGroup> orderByFragments;
|
||||
private boolean hasCollectionJoinFetches;
|
||||
|
||||
private LoaderSelectBuilder(
|
||||
SqlAstCreationContext creationContext,
|
||||
|
@ -731,6 +736,18 @@ public class LoaderSelectBuilder {
|
|||
}
|
||||
}
|
||||
}
|
||||
else if ( loadQueryInfluencers.getEnabledCascadingFetchProfile() != null ) {
|
||||
final CascadeStyle cascadeStyle = ( (AttributeMapping) fetchable ).getAttributeMetadataAccess()
|
||||
.resolveAttributeMetadata( fetchable.findContainingEntityMapping() )
|
||||
.getCascadeStyle();
|
||||
final CascadingAction cascadingAction = loadQueryInfluencers.getEnabledCascadingFetchProfile()
|
||||
.getCascadingAction();
|
||||
if ( cascadeStyle == null || cascadeStyle.doCascade( cascadingAction ) ) {
|
||||
fetchTiming = FetchTiming.IMMEDIATE;
|
||||
// In 5.x the CascadeEntityJoinWalker only join fetched the first collection fetch
|
||||
joined = !hasCollectionJoinFetches;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final Integer maximumFetchDepth = creationContext.getMaximumFetchDepth();
|
||||
|
@ -771,6 +788,7 @@ public class LoaderSelectBuilder {
|
|||
bagRoles.add( fetchable.getNavigableRole().getNavigableName() );
|
||||
}
|
||||
if ( joined ) {
|
||||
hasCollectionJoinFetches = true;
|
||||
final TableGroup joinTableGroup = creationState.getFromClauseAccess()
|
||||
.getTableGroup( fetchablePath );
|
||||
applyFiltering(
|
||||
|
|
|
@ -6,25 +6,33 @@
|
|||
*/
|
||||
package org.hibernate.loader.ast.spi;
|
||||
|
||||
import org.hibernate.engine.spi.CascadingAction;
|
||||
import org.hibernate.engine.spi.CascadingActions;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public enum CascadingFetchProfile {
|
||||
MERGE( "merge" ),
|
||||
REFRESH( "refresh" );
|
||||
MERGE( "merge", CascadingActions.MERGE ),
|
||||
REFRESH( "refresh", CascadingActions.REFRESH );
|
||||
|
||||
private final String legacyName;
|
||||
private final CascadingAction cascadingAction;
|
||||
|
||||
CascadingFetchProfile(String legacyName) {
|
||||
CascadingFetchProfile(String legacyName, CascadingAction cascadingAction) {
|
||||
this.legacyName = legacyName;
|
||||
this.cascadingAction = cascadingAction;
|
||||
}
|
||||
|
||||
public String getLegacyName() {
|
||||
return legacyName;
|
||||
}
|
||||
|
||||
public CascadingAction getCascadingAction() {
|
||||
return cascadingAction;
|
||||
}
|
||||
|
||||
public static CascadingFetchProfile fromLegacyName(String legacyName) {
|
||||
if ( StringHelper.isEmpty( legacyName ) ) {
|
||||
return null;
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.hibernate.sql.results.graph.DomainResultCreationState;
|
|||
*/
|
||||
public interface ForeignKeyDescriptor extends VirtualModelPart {
|
||||
String PART_NAME = "{fk}";
|
||||
String TARGET_PART_NAME = "{fk-target}";
|
||||
|
||||
String getKeyTable();
|
||||
|
||||
|
|
|
@ -237,11 +237,21 @@ public class EmbeddedForeignKeyDescriptor implements ForeignKeyDescriptor {
|
|||
EmbeddableValuedModelPart modelPart,
|
||||
DomainResultCreationState creationState) {
|
||||
final NavigablePath fkNavigablePath = navigablePath.append( getPartName() );
|
||||
creationState.getSqlAstCreationState().getFromClauseAccess().resolveTableGroup(
|
||||
fkNavigablePath,
|
||||
final NavigablePath resultNavigablePath;
|
||||
if ( associationKey.getTable().equals( columnContainingTable ) ) {
|
||||
// todo (6.0): what if we append the actual model part and maybe prefix with `{element}`
|
||||
// resultNavigablePath = navigablePath.append( modelPart.getFetchableName() );
|
||||
// todo (6.0): note that the following is only necessary for detecting circular fetch cycles in ToOneAttributeMapping
|
||||
resultNavigablePath = navigablePath.append( ForeignKeyDescriptor.TARGET_PART_NAME );
|
||||
}
|
||||
else {
|
||||
resultNavigablePath = navigablePath.append( getPartName() );
|
||||
}
|
||||
final TableGroup fkTableGroup = creationState.getSqlAstCreationState().getFromClauseAccess().resolveTableGroup(
|
||||
resultNavigablePath,
|
||||
np -> {
|
||||
final TableGroupJoin tableGroupJoin = modelPart.createTableGroupJoin(
|
||||
fkNavigablePath,
|
||||
resultNavigablePath,
|
||||
tableGroup,
|
||||
null,
|
||||
SqlAstJoinType.INNER,
|
||||
|
@ -251,11 +261,16 @@ public class EmbeddedForeignKeyDescriptor implements ForeignKeyDescriptor {
|
|||
);
|
||||
return tableGroupJoin.getJoinedGroup();
|
||||
}
|
||||
|
||||
);
|
||||
if ( fkNavigablePath != resultNavigablePath ) {
|
||||
creationState.getSqlAstCreationState().getFromClauseAccess().resolveTableGroup(
|
||||
fkNavigablePath,
|
||||
np -> fkTableGroup
|
||||
);
|
||||
}
|
||||
|
||||
return new EmbeddableForeignKeyResultImpl<>(
|
||||
navigablePath,
|
||||
resultNavigablePath,
|
||||
modelPart,
|
||||
null,
|
||||
creationState
|
||||
|
@ -457,7 +472,7 @@ public class EmbeddedForeignKeyDescriptor implements ForeignKeyDescriptor {
|
|||
);
|
||||
|
||||
return new EmbeddableForeignKeyResultImpl<>(
|
||||
navigablePath,
|
||||
fkNavigablePath,
|
||||
keyMappingType,
|
||||
resultVariable,
|
||||
creationState
|
||||
|
|
|
@ -799,6 +799,11 @@ public class MappingModelCreationHelper {
|
|||
public boolean isIncludedInOptimisticLocking() {
|
||||
return bootProperty.isOptimisticLocked();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CascadeStyle getCascadeStyle() {
|
||||
return cascadeStyle;
|
||||
}
|
||||
};
|
||||
|
||||
final FetchStyle style = FetchStrategyHelper.determineFetchStyleByMetadata(
|
||||
|
|
|
@ -380,7 +380,10 @@ public class ToOneAttributeMapping
|
|||
private Key key;
|
||||
}
|
||||
*/
|
||||
if ( parentNavigablePath.getLocalName().equals( ForeignKeyDescriptor.PART_NAME ) ) {
|
||||
if ( parentNavigablePath.getLocalName()
|
||||
.equals( ForeignKeyDescriptor.TARGET_PART_NAME ) || parentNavigablePath.getLocalName().equals(
|
||||
ForeignKeyDescriptor.PART_NAME ) ) {
|
||||
// todo (6.0): maybe it's better to have a flag in creation state that marks if we are building a circular fetch domain result already to skip this?
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -709,7 +712,7 @@ public class ToOneAttributeMapping
|
|||
if ( isNullable ) {
|
||||
sqlAstJoinType = SqlAstJoinType.LEFT;
|
||||
}
|
||||
else if ( parentTableGroup.getModelPart() instanceof EmbeddedCollectionPart ) {
|
||||
else if ( parentTableGroup.getModelPart() instanceof CollectionPart ) {
|
||||
sqlAstJoinType = SqlAstJoinType.LEFT;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -37,7 +37,7 @@ public class EmbeddableForeignKeyResultImpl<T>
|
|||
EmbeddableValuedModelPart embeddableValuedModelPart,
|
||||
String resultVariable,
|
||||
DomainResultCreationState creationState) {
|
||||
super( embeddableValuedModelPart.getEmbeddableTypeDescriptor(), navigablePath.append( ROLE_LOCAL_NAME ) );
|
||||
super( embeddableValuedModelPart.getEmbeddableTypeDescriptor(), navigablePath );
|
||||
this.resultVariable = resultVariable;
|
||||
this.fetches = creationState.visitFetches( this );
|
||||
}
|
||||
|
|
|
@ -34,6 +34,10 @@ public class EntityAssembler implements DomainResultAssembler {
|
|||
|
||||
@Override
|
||||
public Object assemble(RowProcessingState rowProcessingState, JdbcValuesSourceProcessingOptions options) {
|
||||
// Ensure that the instance really is initialized
|
||||
// This is important for key-many-to-ones that are part of a collection key fk,
|
||||
// as the instance is needed for resolveKey before initializing the instance in RowReader
|
||||
initializer.resolveInstance( rowProcessingState );
|
||||
return initializer.getEntityInstance();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.hibernate.engine.FetchStrategy;
|
|||
import org.hibernate.engine.FetchTiming;
|
||||
import org.hibernate.engine.spi.CollectionKey;
|
||||
import org.hibernate.engine.spi.EntityKey;
|
||||
import org.hibernate.engine.spi.PersistenceContext;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.metamodel.mapping.Association;
|
||||
import org.hibernate.metamodel.mapping.AttributeMapping;
|
||||
|
@ -199,7 +200,14 @@ public class CircularBiDirectionalFetchImpl implements BiDirectionalFetch, Assoc
|
|||
|
||||
final SharedSessionContractImplementor session = rowProcessingState.getJdbcValuesSourceProcessingState()
|
||||
.getSession();
|
||||
return session.getPersistenceContext().getEntity( entityKey );
|
||||
final PersistenceContext persistenceContext = session.getPersistenceContext();
|
||||
final Object proxy = persistenceContext.getProxy( entityKey );
|
||||
// it is conceivable there is a proxy, so check that first
|
||||
if ( proxy == null ) {
|
||||
// otherwise look for an initialized version
|
||||
return persistenceContext.getEntity( entityKey );
|
||||
}
|
||||
return proxy;
|
||||
}
|
||||
}
|
||||
if ( initializer.getInitializedInstance() == null ) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.classloader;
|
||||
package org.hibernate.orm.test.classloader;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.comments;
|
||||
package org.hibernate.orm.test.comments;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.comments;
|
||||
package org.hibernate.orm.test.comments;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.comments;
|
||||
package org.hibernate.orm.test.comments;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -100,7 +100,7 @@ public class UseSqlCommentTest extends BaseEntityManagerFunctionalTestCase {
|
|||
public List<TestEntity> findUsingQuery(String id, String appendLiteral, EntityManager entityManager) {
|
||||
TypedQuery<TestEntity> query =
|
||||
entityManager.createQuery(
|
||||
"select new org.hibernate.test.comments.TestEntity(id, '"
|
||||
"select new " + TestEntity.class.getName() + "(id, '"
|
||||
+ appendLiteral.replace( "'", "''" )
|
||||
+ "') from TestEntity where id=:where_id",
|
||||
TestEntity.class
|
|
@ -6,16 +6,14 @@
|
|||
*/
|
||||
|
||||
// $Id: AggressiveReleaseTest.java 10977 2006-12-12 23:28:04Z steve.ebersole@jboss.com $
|
||||
package org.hibernate.test.connections;
|
||||
package org.hibernate.orm.test.connections;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.ScrollableResults;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
|
@ -115,6 +113,7 @@ public class AggressiveReleaseTest extends ConnectionManagementTestCase {
|
|||
// to resources, which should make aggressive-release not release
|
||||
// the connection (and thus cause serialization to fail)
|
||||
ScrollableResults sr = s.createQuery( "from Silly" ).scroll();
|
||||
sr.next();
|
||||
|
||||
try {
|
||||
SerializationHelper.serialize( s );
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.connections;
|
||||
package org.hibernate.orm.test.connections;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
|
||||
package org.hibernate.test.connections;
|
||||
package org.hibernate.orm.test.connections;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.connections;
|
||||
package org.hibernate.orm.test.connections;
|
||||
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
|
@ -31,6 +31,12 @@ import static org.junit.Assert.fail;
|
|||
*/
|
||||
|
||||
public abstract class ConnectionManagementTestCase extends BaseNonConfigCoreFunctionalTestCase {
|
||||
|
||||
@Override
|
||||
protected String getBaseForMappings() {
|
||||
return "org/hibernate/orm/test/";
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String[] getMappings() {
|
||||
return new String[] { "connections/Silly.hbm.xml" };
|
||||
|
@ -126,7 +132,7 @@ public abstract class ConnectionManagementTestCase extends BaseNonConfigCoreFunc
|
|||
Session sessionUnderTest = getSessionUnderTest();
|
||||
|
||||
// force the connection to be retained
|
||||
sessionUnderTest.createQuery( "from Silly" ).scroll();
|
||||
sessionUnderTest.createQuery( "from Silly" ).scroll().next();
|
||||
|
||||
try {
|
||||
SerializationHelper.serialize( sessionUnderTest );
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.connections;
|
||||
package org.hibernate.orm.test.connections;
|
||||
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.dialect.H2Dialect;
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.connections;
|
||||
package org.hibernate.orm.test.connections;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.connections;
|
||||
package org.hibernate.orm.test.connections;
|
||||
|
||||
import java.sql.Blob;
|
||||
import java.sql.Clob;
|
||||
|
@ -26,6 +26,12 @@ import static org.junit.Assert.assertFalse;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class HibernateCreateBlobFailedCase extends BaseCoreFunctionalTestCase {
|
||||
|
||||
@Override
|
||||
protected String getBaseForMappings() {
|
||||
return "org/hibernate/orm/test/";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMappings() {
|
||||
return new String[] { "connections/Silly.hbm.xml" };
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.connections;
|
||||
package org.hibernate.orm.test.connections;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.connections;
|
||||
package org.hibernate.orm.test.connections;
|
||||
|
||||
|
||||
/**
|
|
@ -9,7 +9,7 @@
|
|||
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
||||
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
|
||||
|
||||
<hibernate-mapping package="org.hibernate.test.connections">
|
||||
<hibernate-mapping package="org.hibernate.orm.test.connections">
|
||||
|
||||
<class name="Silly">
|
||||
<id name="id" type="long">
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
// $Id: Silly.java 9595 2006-03-10 18:14:21Z steve.ebersole@jboss.com $
|
||||
package org.hibernate.test.connections;
|
||||
package org.hibernate.orm.test.connections;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
|
@ -5,7 +5,7 @@
|
|||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
|
||||
package org.hibernate.test.connections;
|
||||
package org.hibernate.orm.test.connections;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.connections;
|
||||
package org.hibernate.orm.test.connections;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
// $Id: Car.java 7087 2005-06-08 18:23:44Z steveebersole $
|
||||
package org.hibernate.test.entityname;
|
||||
package org.hibernate.orm.test.entityname;
|
||||
|
||||
|
||||
/**
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.entityname;
|
||||
package org.hibernate.orm.test.entityname;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
|
@ -39,7 +39,7 @@ public class DuplicateEntityNameTest extends BaseCoreFunctionalTestCase {
|
|||
fail("Should throw DuplicateMappingException");
|
||||
}
|
||||
catch (DuplicateMappingException e) {
|
||||
assertEquals( "The [org.hibernate.test.entityname.DuplicateEntityNameTest$Purchase1] and [org.hibernate.test.entityname.DuplicateEntityNameTest$Purchase2] entities share the same JPA entity name: [Purchase] which is not allowed!", e.getMessage() );
|
||||
assertEquals( "The [org.hibernate.orm.test.entityname.DuplicateEntityNameTest$Purchase1] and [org.hibernate.orm.test.entityname.DuplicateEntityNameTest$Purchase2] entities share the same JPA entity name: [Purchase], which is not allowed!", e.getMessage() );
|
||||
}
|
||||
}
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.entityname;
|
||||
package org.hibernate.orm.test.entityname;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.hibernate.Session;
|
||||
|
@ -16,6 +16,13 @@ import static org.junit.Assert.assertEquals;
|
|||
* @author stliu
|
||||
*/
|
||||
public class EntityNameFromSubClassTest extends BaseCoreFunctionalTestCase {
|
||||
|
||||
@Override
|
||||
protected String getBaseForMappings() {
|
||||
return "org/hibernate/orm/test/";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMappings() {
|
||||
return new String[] { "entityname/Vehicle.hbm.xml" };
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.entityname;
|
||||
package org.hibernate.orm.test.entityname;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
/**
|
|
@ -9,7 +9,7 @@
|
|||
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
||||
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
|
||||
|
||||
<hibernate-mapping package="org.hibernate.test.entityname">
|
||||
<hibernate-mapping package="org.hibernate.orm.test.entityname">
|
||||
|
||||
<!-- Vehicle represents an abstract root of a union-subclass hierarchy -->
|
||||
<class name="Vehicle" abstract="true" entity-name="VEHICLE" discriminator-value="V">
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
// $Id: Vehicle.java 7087 2005-06-08 18:23:44Z steveebersole $
|
||||
package org.hibernate.test.entityname;
|
||||
package org.hibernate.orm.test.entityname;
|
||||
|
||||
|
||||
/**
|
|
@ -4,9 +4,10 @@
|
|||
* 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.test.event.collection;
|
||||
package org.hibernate.orm.test.event.collection;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -21,7 +22,7 @@ import org.hibernate.dialect.AbstractHANADialect;
|
|||
import org.hibernate.event.spi.AbstractCollectionEvent;
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
import org.hibernate.test.event.collection.association.bidirectional.manytomany.ChildWithBidirectionalManyToMany;
|
||||
import org.hibernate.orm.test.event.collection.association.bidirectional.manytomany.ChildWithBidirectionalManyToMany;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
@ -33,6 +34,12 @@ import static org.junit.Assert.assertSame;
|
|||
* @author Gail Badner
|
||||
*/
|
||||
public abstract class AbstractCollectionEventTest extends BaseCoreFunctionalTestCase {
|
||||
|
||||
@Override
|
||||
protected String getBaseForMappings() {
|
||||
return "org/hibernate/orm/test/";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void cleanupTest() {
|
||||
ParentWithCollection dummyParent = createParent( "dummyParent" );
|
||||
|
@ -41,15 +48,19 @@ public abstract class AbstractCollectionEventTest extends BaseCoreFunctionalTest
|
|||
inTransaction(
|
||||
s -> {
|
||||
CriteriaBuilder criteriaBuilder = s.getCriteriaBuilder();
|
||||
CriteriaQuery<? extends Child> childrenCriteria = criteriaBuilder.createQuery( dummyChild.getClass() );
|
||||
childrenCriteria.from( dummyChild.getClass() );
|
||||
List children = s.createQuery( childrenCriteria ).list();
|
||||
// List children = s.createCriteria( dummyChild.getClass() ).list();
|
||||
List children;
|
||||
if ( s.getFactory().getMetamodel().findEntityDescriptor( dummyChild.getClass() ) == null ) {
|
||||
children = Collections.emptyList();
|
||||
}
|
||||
else {
|
||||
CriteriaQuery<? extends Child> childrenCriteria = criteriaBuilder.createQuery( dummyChild.getClass() );
|
||||
childrenCriteria.from( dummyChild.getClass() );
|
||||
children = s.createQuery( childrenCriteria ).list();
|
||||
}
|
||||
|
||||
CriteriaQuery<? extends ParentWithCollection> parentsCriteria = criteriaBuilder.createQuery( dummyParent.getClass() );
|
||||
childrenCriteria.from( dummyParent.getClass() );
|
||||
parentsCriteria.from( dummyParent.getClass() );
|
||||
List parents = s.createQuery( parentsCriteria ).list();
|
||||
// List parents = s.createCriteria( dummyParent.getClass() ).list();
|
||||
for ( Iterator it = parents.iterator(); it.hasNext(); ) {
|
||||
ParentWithCollection parent = ( ParentWithCollection ) it.next();
|
||||
parent.clearChildren();
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
//$Id: $
|
||||
|
||||
package org.hibernate.test.event.collection;
|
||||
package org.hibernate.orm.test.event.collection;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.event.collection;
|
||||
package org.hibernate.orm.test.event.collection;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
@ -19,8 +19,8 @@ import org.hibernate.Session;
|
|||
import org.hibernate.Transaction;
|
||||
import org.hibernate.collection.spi.PersistentCollection;
|
||||
import org.hibernate.event.spi.AbstractCollectionEvent;
|
||||
import org.hibernate.test.event.collection.association.bidirectional.manytomany.ChildWithBidirectionalManyToMany;
|
||||
import org.hibernate.test.event.collection.association.unidirectional.ParentWithCollectionOfEntities;
|
||||
import org.hibernate.orm.test.event.collection.association.bidirectional.manytomany.ChildWithBidirectionalManyToMany;
|
||||
import org.hibernate.orm.test.event.collection.association.unidirectional.ParentWithCollectionOfEntities;
|
||||
import org.hibernate.testing.DialectChecks;
|
||||
import org.hibernate.testing.FailureExpected;
|
||||
import org.hibernate.testing.RequiresDialectFeature;
|
||||
|
@ -39,6 +39,13 @@ import static org.junit.Assert.assertSame;
|
|||
*/
|
||||
@RequiresDialectFeature(DialectChecks.SupportsNoColumnInsert.class)
|
||||
public class BrokenCollectionEventTest extends BaseCoreFunctionalTestCase {
|
||||
|
||||
|
||||
@Override
|
||||
protected String getBaseForMappings() {
|
||||
return "org/hibernate/orm/test/";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMappings() {
|
||||
return new String[] { "event/collection/association/unidirectional/onetomany/UnidirectionalOneToManySetMapping.hbm.xml" };
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
//$Id: $
|
||||
|
||||
package org.hibernate.test.event.collection;
|
||||
package org.hibernate.orm.test.event.collection;
|
||||
|
||||
|
||||
/**
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
//$Id: $
|
||||
|
||||
package org.hibernate.test.event.collection;
|
||||
package org.hibernate.orm.test.event.collection;
|
||||
|
||||
|
||||
/**
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
//$Id: $
|
||||
|
||||
package org.hibernate.test.event.collection;
|
||||
package org.hibernate.orm.test.event.collection;
|
||||
|
||||
|
||||
/**
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.event.collection;
|
||||
package org.hibernate.orm.test.event.collection;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.event.collection;
|
||||
package org.hibernate.orm.test.event.collection;
|
||||
|
||||
|
||||
/**
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
//$Id: $
|
||||
|
||||
package org.hibernate.test.event.collection;
|
||||
package org.hibernate.orm.test.event.collection;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
|
@ -4,17 +4,18 @@
|
|||
* 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.test.event.collection.association;
|
||||
package org.hibernate.orm.test.event.collection.association;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.dialect.AbstractHANADialect;
|
||||
import org.hibernate.test.event.collection.AbstractCollectionEventTest;
|
||||
import org.hibernate.test.event.collection.ChildEntity;
|
||||
import org.hibernate.test.event.collection.CollectionListeners;
|
||||
import org.hibernate.test.event.collection.ParentWithCollection;
|
||||
import org.hibernate.test.event.collection.association.bidirectional.manytomany.ChildWithBidirectionalManyToMany;
|
||||
import org.hibernate.orm.test.event.collection.AbstractCollectionEventTest;
|
||||
import org.hibernate.orm.test.event.collection.ChildEntity;
|
||||
import org.hibernate.orm.test.event.collection.CollectionListeners;
|
||||
import org.hibernate.orm.test.event.collection.ParentWithCollection;
|
||||
import org.hibernate.orm.test.event.collection.association.bidirectional.manytomany.ChildWithBidirectionalManyToMany;
|
||||
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
|
||||
/**
|
|
@ -4,12 +4,12 @@
|
|||
* 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.test.event.collection.association.bidirectional.manytomany;
|
||||
package org.hibernate.orm.test.event.collection.association.bidirectional.manytomany;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.hibernate.test.event.collection.ParentWithCollection;
|
||||
import org.hibernate.test.event.collection.association.AbstractAssociationCollectionEventTest;
|
||||
import org.hibernate.orm.test.event.collection.ParentWithCollection;
|
||||
import org.hibernate.orm.test.event.collection.association.AbstractAssociationCollectionEventTest;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
-->
|
||||
|
||||
<hibernate-mapping package="org.hibernate.test.event.collection.association.bidirectional.manytomany">
|
||||
<hibernate-mapping package="org.hibernate.orm.test.event.collection.association.bidirectional.manytomany">
|
||||
|
||||
<class name="ParentWithBidirectionalManyToMany" table="PARENT">
|
||||
<id name="id" column="ID" type="long">
|
|
@ -4,12 +4,12 @@
|
|||
* 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.test.event.collection.association.bidirectional.manytomany;
|
||||
package org.hibernate.orm.test.event.collection.association.bidirectional.manytomany;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.hibernate.test.event.collection.ParentWithCollection;
|
||||
import org.hibernate.test.event.collection.association.AbstractAssociationCollectionEventTest;
|
||||
import org.hibernate.orm.test.event.collection.ParentWithCollection;
|
||||
import org.hibernate.orm.test.event.collection.association.AbstractAssociationCollectionEventTest;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
-->
|
||||
|
||||
<hibernate-mapping package="org.hibernate.test.event.collection.association.bidirectional.manytomany">
|
||||
<hibernate-mapping package="org.hibernate.orm.test.event.collection.association.bidirectional.manytomany">
|
||||
|
||||
<class name="ParentWithBidirectionalManyToMany" table="PARENT">
|
||||
<id name="id" column="ID" type="long">
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
//$Id: $
|
||||
|
||||
package org.hibernate.test.event.collection.association.bidirectional.manytomany;
|
||||
package org.hibernate.orm.test.event.collection.association.bidirectional.manytomany;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.hibernate.test.event.collection.ChildEntity;
|
||||
import org.hibernate.orm.test.event.collection.ChildEntity;
|
||||
|
||||
/**
|
||||
*
|
|
@ -7,13 +7,13 @@
|
|||
|
||||
//$Id: $
|
||||
|
||||
package org.hibernate.test.event.collection.association.bidirectional.manytomany;
|
||||
package org.hibernate.orm.test.event.collection.association.bidirectional.manytomany;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.hibernate.test.event.collection.AbstractParentWithCollection;
|
||||
import org.hibernate.test.event.collection.Child;
|
||||
import org.hibernate.orm.test.event.collection.AbstractParentWithCollection;
|
||||
import org.hibernate.orm.test.event.collection.Child;
|
||||
|
||||
/**
|
||||
*
|
|
@ -4,13 +4,13 @@
|
|||
* 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.test.event.collection.association.bidirectional.onetomany;
|
||||
package org.hibernate.orm.test.event.collection.association.bidirectional.onetomany;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.hibernate.test.event.collection.Child;
|
||||
import org.hibernate.test.event.collection.ParentWithCollection;
|
||||
import org.hibernate.test.event.collection.association.AbstractAssociationCollectionEventTest;
|
||||
import org.hibernate.orm.test.event.collection.Child;
|
||||
import org.hibernate.orm.test.event.collection.ParentWithCollection;
|
||||
import org.hibernate.orm.test.event.collection.association.AbstractAssociationCollectionEventTest;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
-->
|
||||
|
||||
<hibernate-mapping package="org.hibernate.test.event.collection.association.bidirectional.onetomany">
|
||||
<hibernate-mapping package="org.hibernate.orm.test.event.collection.association.bidirectional.onetomany">
|
||||
|
||||
<class name="ParentWithBidirectionalOneToMany" table="PARENT">
|
||||
<id name="id" column="ID" type="long">
|
|
@ -4,9 +4,9 @@
|
|||
* 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.test.event.collection.association.bidirectional.onetomany;
|
||||
package org.hibernate.orm.test.event.collection.association.bidirectional.onetomany;
|
||||
|
||||
import org.hibernate.test.event.collection.ParentWithCollection;
|
||||
import org.hibernate.orm.test.event.collection.ParentWithCollection;
|
||||
|
||||
/**
|
||||
* @author Gail Badner
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
-->
|
||||
|
||||
<hibernate-mapping package="org.hibernate.test.event.collection.association.bidirectional.onetomany">
|
||||
<hibernate-mapping package="org.hibernate.orm.test.event.collection.association.bidirectional.onetomany">
|
||||
|
||||
<class name="ParentWithBidirectionalOneToMany" table="PARENT" discriminator-value="P">
|
||||
<id name="id" column="ID" type="long">
|
|
@ -4,13 +4,13 @@
|
|||
* 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.test.event.collection.association.bidirectional.onetomany;
|
||||
package org.hibernate.orm.test.event.collection.association.bidirectional.onetomany;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.hibernate.test.event.collection.Child;
|
||||
import org.hibernate.test.event.collection.ParentWithCollection;
|
||||
import org.hibernate.test.event.collection.association.AbstractAssociationCollectionEventTest;
|
||||
import org.hibernate.orm.test.event.collection.Child;
|
||||
import org.hibernate.orm.test.event.collection.ParentWithCollection;
|
||||
import org.hibernate.orm.test.event.collection.association.AbstractAssociationCollectionEventTest;
|
||||
|
||||
/**
|
||||
* @author Gail Badner
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
-->
|
||||
|
||||
<hibernate-mapping package="org.hibernate.test.event.collection.association.bidirectional.onetomany">
|
||||
<hibernate-mapping package="org.hibernate.orm.test.event.collection.association.bidirectional.onetomany">
|
||||
|
||||
<class name="ParentWithBidirectionalOneToMany" table="PARENT">
|
||||
<id name="id" column="ID" type="long">
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
//$Id: $
|
||||
|
||||
package org.hibernate.test.event.collection.association.bidirectional.onetomany;
|
||||
import org.hibernate.test.event.collection.ChildEntity;
|
||||
import org.hibernate.test.event.collection.ParentWithCollection;
|
||||
package org.hibernate.orm.test.event.collection.association.bidirectional.onetomany;
|
||||
import org.hibernate.orm.test.event.collection.ChildEntity;
|
||||
import org.hibernate.orm.test.event.collection.ParentWithCollection;
|
||||
|
||||
/**
|
||||
* @author Gail Badner
|
|
@ -7,12 +7,12 @@
|
|||
|
||||
//$Id: $
|
||||
|
||||
package org.hibernate.test.event.collection.association.bidirectional.onetomany;
|
||||
package org.hibernate.orm.test.event.collection.association.bidirectional.onetomany;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.hibernate.test.event.collection.AbstractParentWithCollection;
|
||||
import org.hibernate.test.event.collection.Child;
|
||||
import org.hibernate.orm.test.event.collection.AbstractParentWithCollection;
|
||||
import org.hibernate.orm.test.event.collection.Child;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -26,7 +26,7 @@ public class ParentWithBidirectionalOneToMany extends AbstractParentWithCollecti
|
|||
super( name );
|
||||
}
|
||||
|
||||
public Child createChild( String name ) {
|
||||
public Child createChild(String name ) {
|
||||
return new ChildWithManyToOne( name );
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
//$Id: $
|
||||
|
||||
package org.hibernate.test.event.collection.association.bidirectional.onetomany;
|
||||
package org.hibernate.orm.test.event.collection.association.bidirectional.onetomany;
|
||||
|
||||
|
||||
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
//$Id: $
|
||||
|
||||
package org.hibernate.test.event.collection.association.unidirectional;
|
||||
import org.hibernate.test.event.collection.AbstractParentWithCollection;
|
||||
import org.hibernate.test.event.collection.Child;
|
||||
import org.hibernate.test.event.collection.ChildEntity;
|
||||
package org.hibernate.orm.test.event.collection.association.unidirectional;
|
||||
import org.hibernate.orm.test.event.collection.AbstractParentWithCollection;
|
||||
import org.hibernate.orm.test.event.collection.Child;
|
||||
import org.hibernate.orm.test.event.collection.ChildEntity;
|
||||
|
||||
/**
|
||||
* @author Gail Badner
|
|
@ -4,16 +4,16 @@
|
|||
* 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.test.event.collection.association.unidirectional.manytomany;
|
||||
package org.hibernate.orm.test.event.collection.association.unidirectional.manytomany;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.hibernate.test.event.collection.Child;
|
||||
import org.hibernate.test.event.collection.ChildEntity;
|
||||
import org.hibernate.test.event.collection.ParentWithCollection;
|
||||
import org.hibernate.test.event.collection.association.AbstractAssociationCollectionEventTest;
|
||||
import org.hibernate.test.event.collection.association.unidirectional.ParentWithCollectionOfEntities;
|
||||
import org.hibernate.orm.test.event.collection.Child;
|
||||
import org.hibernate.orm.test.event.collection.ChildEntity;
|
||||
import org.hibernate.orm.test.event.collection.ParentWithCollection;
|
||||
import org.hibernate.orm.test.event.collection.association.AbstractAssociationCollectionEventTest;
|
||||
import org.hibernate.orm.test.event.collection.association.unidirectional.ParentWithCollectionOfEntities;
|
||||
|
||||
/**
|
||||
* @author Gail Badner
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
-->
|
||||
|
||||
<hibernate-mapping package="org.hibernate.test.event.collection.association.unidirectional">
|
||||
<hibernate-mapping package="org.hibernate.orm.test.event.collection.association.unidirectional">
|
||||
|
||||
<class name="ParentWithCollectionOfEntities" table="PARENT">
|
||||
<id name="id" column="ID" type="long">
|
||||
|
@ -22,11 +22,11 @@
|
|||
<bag name="children" table="PARENT_CHILD"
|
||||
inverse="false" cascade="all">
|
||||
<key column="parent_id"/>
|
||||
<many-to-many column="child_id" class="org.hibernate.test.event.collection.ChildEntity"/>
|
||||
<many-to-many column="child_id" class="org.hibernate.orm.test.event.collection.ChildEntity"/>
|
||||
</bag>
|
||||
</class>
|
||||
|
||||
<class name="org.hibernate.test.event.collection.ChildEntity" table="CHILD">
|
||||
<class name="org.hibernate.orm.test.event.collection.ChildEntity" table="CHILD">
|
||||
<id name="id" column="ID" type="long">
|
||||
<generator class="native"/>
|
||||
</id>
|
|
@ -4,16 +4,16 @@
|
|||
* 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.test.event.collection.association.unidirectional.onetomany;
|
||||
package org.hibernate.orm.test.event.collection.association.unidirectional.onetomany;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.hibernate.test.event.collection.Child;
|
||||
import org.hibernate.test.event.collection.ChildEntity;
|
||||
import org.hibernate.test.event.collection.ParentWithCollection;
|
||||
import org.hibernate.test.event.collection.association.AbstractAssociationCollectionEventTest;
|
||||
import org.hibernate.test.event.collection.association.unidirectional.ParentWithCollectionOfEntities;
|
||||
import org.hibernate.orm.test.event.collection.Child;
|
||||
import org.hibernate.orm.test.event.collection.ChildEntity;
|
||||
import org.hibernate.orm.test.event.collection.ParentWithCollection;
|
||||
import org.hibernate.orm.test.event.collection.association.AbstractAssociationCollectionEventTest;
|
||||
import org.hibernate.orm.test.event.collection.association.unidirectional.ParentWithCollectionOfEntities;
|
||||
|
||||
/**
|
||||
*
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
-->
|
||||
|
||||
<hibernate-mapping package="org.hibernate.test.event.collection.association.unidirectional">
|
||||
<hibernate-mapping package="org.hibernate.orm.test.event.collection.association.unidirectional">
|
||||
|
||||
<class name="ParentWithCollectionOfEntities" table="PARENT">
|
||||
<id name="id" column="ID" type="long">
|
||||
|
@ -22,11 +22,11 @@
|
|||
<bag name="children"
|
||||
cascade="all">
|
||||
<key column="parent_id"/>
|
||||
<one-to-many class="org.hibernate.test.event.collection.ChildEntity"/>
|
||||
<one-to-many class="org.hibernate.orm.test.event.collection.ChildEntity"/>
|
||||
</bag>
|
||||
</class>
|
||||
|
||||
<class name="org.hibernate.test.event.collection.ChildEntity" table="CHILD">
|
||||
<class name="org.hibernate.orm.test.event.collection.ChildEntity" table="CHILD">
|
||||
<id name="id" column="ID" type="long">
|
||||
<generator class="native"/>
|
||||
</id>
|
|
@ -4,14 +4,14 @@
|
|||
* 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.test.event.collection.association.unidirectional.onetomany;
|
||||
package org.hibernate.orm.test.event.collection.association.unidirectional.onetomany;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.hibernate.test.event.collection.ParentWithCollection;
|
||||
import org.hibernate.test.event.collection.association.AbstractAssociationCollectionEventTest;
|
||||
import org.hibernate.test.event.collection.association.unidirectional.ParentWithCollectionOfEntities;
|
||||
import org.hibernate.orm.test.event.collection.ParentWithCollection;
|
||||
import org.hibernate.orm.test.event.collection.association.AbstractAssociationCollectionEventTest;
|
||||
import org.hibernate.orm.test.event.collection.association.unidirectional.ParentWithCollectionOfEntities;
|
||||
|
||||
/**
|
||||
* @author Gail Badner
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
-->
|
||||
|
||||
<hibernate-mapping package="org.hibernate.test.event.collection.association.unidirectional">
|
||||
<hibernate-mapping package="org.hibernate.orm.test.event.collection.association.unidirectional">
|
||||
|
||||
<class name="ParentWithCollectionOfEntities" table="PARENT">
|
||||
<id name="id" column="ID" type="long">
|
||||
|
@ -22,11 +22,11 @@
|
|||
<set name="children"
|
||||
cascade="all">
|
||||
<key column="parent_id"/>
|
||||
<one-to-many class="org.hibernate.test.event.collection.ChildEntity"/>
|
||||
<one-to-many class="org.hibernate.orm.test.event.collection.ChildEntity"/>
|
||||
</set>
|
||||
</class>
|
||||
|
||||
<class name="org.hibernate.test.event.collection.ChildEntity" table="CHILD">
|
||||
<class name="org.hibernate.orm.test.event.collection.ChildEntity" table="CHILD">
|
||||
<id name="id" column="ID" type="long">
|
||||
<generator class="native"/>
|
||||
</id>
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.event.collection.detached;
|
||||
package org.hibernate.orm.test.event.collection.detached;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
|
@ -4,14 +4,13 @@
|
|||
* 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.test.event.collection.detached;
|
||||
package org.hibernate.orm.test.event.collection.detached;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Index;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.Table;
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.event.collection.detached;
|
||||
package org.hibernate.orm.test.event.collection.detached;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.event.collection.detached;
|
||||
package org.hibernate.orm.test.event.collection.detached;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.event.collection.detached;
|
||||
package org.hibernate.orm.test.event.collection.detached;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
@ -15,6 +15,7 @@ import org.hibernate.event.spi.AbstractCollectionEvent;
|
|||
import org.hibernate.event.spi.PostCollectionRecreateEvent;
|
||||
import org.hibernate.event.spi.PreCollectionRemoveEvent;
|
||||
import org.hibernate.event.spi.PreCollectionUpdateEvent;
|
||||
import org.hibernate.orm.test.event.collection.Entity;
|
||||
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
|
@ -33,6 +34,11 @@ import static org.junit.Assert.assertSame;
|
|||
@TestForIssue( jiraKey = "HHH-6361" )
|
||||
public class DetachedMultipleCollectionChangeTest extends BaseCoreFunctionalTestCase {
|
||||
|
||||
@Override
|
||||
protected String getBaseForMappings() {
|
||||
return "org/hibernate/orm/test/";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMappings() {
|
||||
return new String[] { "event/collection/detached/MultipleCollectionBagMapping.hbm.xml" };
|
||||
|
@ -219,8 +225,8 @@ public class DetachedMultipleCollectionChangeTest extends BaseCoreFunctionalTest
|
|||
protected void checkListener(
|
||||
MultipleCollectionListeners listeners,
|
||||
MultipleCollectionListeners.Listener listenerExpected,
|
||||
org.hibernate.test.event.collection.Entity ownerExpected,
|
||||
List<? extends org.hibernate.test.event.collection.Entity> expectedCollectionEntrySnapshot,
|
||||
Entity ownerExpected,
|
||||
List<? extends Entity> expectedCollectionEntrySnapshot,
|
||||
int index) {
|
||||
AbstractCollectionEvent event = listeners
|
||||
.getEvents().get(index);
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.event.collection.detached;
|
||||
package org.hibernate.orm.test.event.collection.detached;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.event.collection.detached;
|
||||
package org.hibernate.orm.test.event.collection.detached;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
-->
|
||||
|
||||
<hibernate-mapping package="org.hibernate.test.event.collection.detached">
|
||||
<hibernate-mapping package="org.hibernate.orm.test.event.collection.detached">
|
||||
|
||||
<class name="MultipleCollectionEntity" table="PARENT">
|
||||
<id name="id" column="ID" type="long">
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.event.collection.detached;
|
||||
package org.hibernate.orm.test.event.collection.detached;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -19,7 +19,7 @@ import javax.persistence.JoinColumn;
|
|||
import javax.persistence.OneToMany;
|
||||
|
||||
@Entity
|
||||
public class MultipleCollectionEntity implements org.hibernate.test.event.collection.Entity {
|
||||
public class MultipleCollectionEntity implements org.hibernate.orm.test.event.collection.Entity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.event.collection.detached;
|
||||
package org.hibernate.orm.test.event.collection.detached;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.event.collection.detached;
|
||||
package org.hibernate.orm.test.event.collection.detached;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
@ -15,7 +15,7 @@ import javax.persistence.JoinColumn;
|
|||
import javax.persistence.ManyToOne;
|
||||
|
||||
@Entity
|
||||
public class MultipleCollectionRefEntity1 implements org.hibernate.test.event.collection.Entity {
|
||||
public class MultipleCollectionRefEntity1 implements org.hibernate.orm.test.event.collection.Entity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.event.collection.detached;
|
||||
package org.hibernate.orm.test.event.collection.detached;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
@ -15,7 +15,7 @@ import javax.persistence.JoinColumn;
|
|||
import javax.persistence.ManyToOne;
|
||||
|
||||
@Entity
|
||||
public class MultipleCollectionRefEntity2 implements org.hibernate.test.event.collection.Entity {
|
||||
public class MultipleCollectionRefEntity2 implements org.hibernate.orm.test.event.collection.Entity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
//$Id: $
|
||||
|
||||
package org.hibernate.test.event.collection.values;
|
||||
import org.hibernate.test.event.collection.AbstractParentWithCollection;
|
||||
import org.hibernate.test.event.collection.Child;
|
||||
import org.hibernate.test.event.collection.ChildValue;
|
||||
package org.hibernate.orm.test.event.collection.values;
|
||||
import org.hibernate.orm.test.event.collection.AbstractParentWithCollection;
|
||||
import org.hibernate.orm.test.event.collection.Child;
|
||||
import org.hibernate.orm.test.event.collection.ChildValue;
|
||||
|
||||
/**
|
||||
*
|
|
@ -4,13 +4,13 @@
|
|||
* 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.test.event.collection.values;
|
||||
package org.hibernate.orm.test.event.collection.values;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.hibernate.test.event.collection.AbstractCollectionEventTest;
|
||||
import org.hibernate.test.event.collection.ParentWithCollection;
|
||||
import org.hibernate.orm.test.event.collection.AbstractCollectionEventTest;
|
||||
import org.hibernate.orm.test.event.collection.ParentWithCollection;
|
||||
|
||||
/**
|
||||
*
|
|
@ -9,7 +9,7 @@
|
|||
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
||||
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
|
||||
|
||||
<hibernate-mapping package="org.hibernate.test.event.collection.values">
|
||||
<hibernate-mapping package="org.hibernate.orm.test.event.collection.values">
|
||||
|
||||
<class name="ParentWithCollectionOfValues" table="PARENT">
|
||||
<id name="id" column="ID" type="long">
|
||||
|
@ -18,11 +18,10 @@
|
|||
<bag name="children"
|
||||
cascade="all">
|
||||
<key column="parent_id"/>
|
||||
<composite-element class="org.hibernate.test.event.collection.ChildValue">
|
||||
<composite-element class="org.hibernate.orm.test.event.collection.ChildValue">
|
||||
<property name="name"/>
|
||||
</composite-element>
|
||||
</bag>
|
||||
</class>
|
||||
|
||||
</hibernate-mapping>
|
||||
Pr
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.event.entity;
|
||||
package org.hibernate.orm.test.event.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.event.entity;
|
||||
package org.hibernate.orm.test.event.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.events;
|
||||
package org.hibernate.orm.test.events;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.events;
|
||||
package org.hibernate.orm.test.events;
|
||||
|
||||
import java.util.Set;
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.events;
|
||||
package org.hibernate.orm.test.events;
|
||||
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.boot.Metadata;
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.events;
|
||||
package org.hibernate.orm.test.events;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.events;
|
||||
package org.hibernate.orm.test.events;
|
||||
|
||||
import org.hibernate.IrrelevantEntity;
|
||||
import org.hibernate.Session;
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.events;
|
||||
package org.hibernate.orm.test.events;
|
||||
|
||||
import org.hibernate.IrrelevantEntity;
|
||||
import org.hibernate.Session;
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.eviction;
|
||||
package org.hibernate.orm.test.eviction;
|
||||
|
||||
import org.hibernate.Session;
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.eviction;
|
||||
package org.hibernate.orm.test.eviction;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
|
@ -7,7 +7,7 @@
|
|||
-->
|
||||
<!DOCTYPE hibernate-mapping SYSTEM "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd" >
|
||||
|
||||
<hibernate-mapping package="org.hibernate.test.exception" >
|
||||
<hibernate-mapping package="org.hibernate.orm.test.exception" >
|
||||
<class name="Group" table="T_GROUP" >
|
||||
<id name="id" unsaved-value="null" column="group_id" >
|
||||
<generator class="native"/>
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
// $Id: Group.java 4746 2004-11-11 20:57:28Z steveebersole $
|
||||
package org.hibernate.test.exception;
|
||||
package org.hibernate.orm.test.exception;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.exception;
|
||||
package org.hibernate.orm.test.exception;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
|
@ -34,6 +34,13 @@ import static org.junit.Assert.fail;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class SQLExceptionConversionTest extends BaseCoreFunctionalTestCase {
|
||||
|
||||
@Override
|
||||
protected String getBaseForMappings() {
|
||||
return "org/hibernate/orm/test/";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMappings() {
|
||||
return new String[] {"exception/User.hbm.xml", "exception/Group.hbm.xml"};
|
||||
}
|
|
@ -7,7 +7,7 @@
|
|||
-->
|
||||
<!DOCTYPE hibernate-mapping SYSTEM "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd" >
|
||||
|
||||
<hibernate-mapping package="org.hibernate.test.exception" >
|
||||
<hibernate-mapping package="org.hibernate.orm.test.exception" >
|
||||
<class name="User" table="T_USER" >
|
||||
<id name="id" unsaved-value="null" column="user_id" >
|
||||
<generator class="native"/>
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
// $Id: User.java 4746 2004-11-11 20:57:28Z steveebersole $
|
||||
package org.hibernate.test.exception;
|
||||
package org.hibernate.orm.test.exception;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
* 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.test.fetch.runtime.managed;
|
||||
package org.hibernate.orm.test.fetch.runtime.managed;
|
||||
|
||||
import java.util.Collections;
|
||||
import javax.persistence.Entity;
|
|
@ -12,4 +12,4 @@
|
|||
* * EntityGraph
|
||||
* * fetch profile (?)
|
||||
*/
|
||||
package org.hibernate.test.fetch.runtime.managed;
|
||||
package org.hibernate.orm.test.fetch.runtime.managed;
|
|
@ -20,6 +20,7 @@ import org.hibernate.StaleObjectStateException;
|
|||
import org.hibernate.StaleStateException;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.jpa.QueryHints;
|
||||
import org.hibernate.metamodel.MappingMetamodel;
|
||||
import org.hibernate.query.spi.QueryImplementor;
|
||||
|
||||
|
@ -1197,24 +1198,27 @@ public abstract class AbstractEntityWithOneToManyTest {
|
|||
CriteriaBuilder criteriaBuilder = s.getCriteriaBuilder();
|
||||
CriteriaQuery<Contract> criteria = criteriaBuilder.createQuery( Contract.class );
|
||||
criteria.from( Contract.class );
|
||||
|
||||
QueryImplementor<Contract> query = s.createQuery( criteria );
|
||||
query.setHint( "javax.persistence.fetchgraph", s.createEntityGraph( Contract.class) );
|
||||
return query.uniqueResult();
|
||||
return s.createQuery( criteria )
|
||||
.setHint( QueryHints.HINT_FETCHGRAPH, s.createEntityGraph( Contract.class ) )
|
||||
.uniqueResult();
|
||||
}
|
||||
|
||||
private ContractVariation getContractVariation(SessionImplementor s) {
|
||||
CriteriaBuilder criteriaBuilder = s.getCriteriaBuilder();
|
||||
CriteriaQuery<ContractVariation> criteria = criteriaBuilder.createQuery( ContractVariation.class );
|
||||
criteria.from( ContractVariation.class );
|
||||
return s.createQuery( criteria ).uniqueResult();
|
||||
return s.createQuery( criteria )
|
||||
.setHint( QueryHints.HINT_FETCHGRAPH, s.createEntityGraph( ContractVariation.class ) )
|
||||
.uniqueResult();
|
||||
}
|
||||
|
||||
private Party getParty(SessionImplementor s) {
|
||||
CriteriaBuilder criteriaBuilder = s.getCriteriaBuilder();
|
||||
CriteriaQuery<Party> criteria = criteriaBuilder.createQuery( Party.class );
|
||||
criteria.from( Party.class );
|
||||
return s.createQuery( criteria ).uniqueResult();
|
||||
return s.createQuery( criteria )
|
||||
.setHint( QueryHints.HINT_FETCHGRAPH, s.createEntityGraph( Party.class ) )
|
||||
.uniqueResult();
|
||||
}
|
||||
|
||||
private void assertPartyAndContractAreDeleted(SessionImplementor s) {
|
||||
|
|
Loading…
Reference in New Issue