HHH-8276 - Integrate LoadPlans into UniqueEntityLoader (PoC)

This commit is contained in:
Steve Ebersole 2013-07-25 13:12:36 -05:00
parent af1061a42d
commit b10c51eec7
16 changed files with 72 additions and 25 deletions

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.loader.plan.spi;
package org.hibernate.test.loadplans.plans;
import javax.persistence.CascadeType;
import javax.persistence.Entity;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.loader.plan.spi;
package org.hibernate.test.loadplans.plans;
import org.hibernate.LockMode;
import org.hibernate.LockOptions;

View File

@ -21,20 +21,15 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.loader.plan.spi;
package org.hibernate.test.loadplans.plans;
import org.hibernate.cfg.Configuration;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.test.loader.EncapsulatedCompositeIdResultSetProcessorTest;
import org.hibernate.test.loader.Helper;
import org.hibernate.test.loadplans.process.EncapsulatedCompositeIdResultSetProcessorTest;
import org.hibernate.loader.plan2.build.internal.returns.SimpleEntityIdentifierDescriptionImpl;
import org.hibernate.loader.plan2.exec.process.internal.ResultSetProcessorImpl;
import org.hibernate.loader.plan2.exec.spi.EntityLoadQueryDetails;
//import org.hibernate.loader.plan2.spi.BidirectionalEntityFetch;
import org.hibernate.loader.plan2.build.internal.returns.CollectionFetchableElementEntityGraph;
import org.hibernate.loader.plan2.spi.CollectionFetch;
import org.hibernate.loader.plan2.spi.CompositeFetch;
import org.hibernate.loader.plan2.spi.EntityFetch;
import org.hibernate.loader.plan2.spi.EntityReturn;
import org.hibernate.loader.plan2.spi.FetchSource;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.loader;
package org.hibernate.test.loadplans.process;
import javax.persistence.CollectionTable;
import javax.persistence.Column;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.loader;
package org.hibernate.test.loadplans.process;
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.loader;
package org.hibernate.test.loadplans.process;
import javax.persistence.CascadeType;
import javax.persistence.Entity;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.loader;
package org.hibernate.test.loadplans.process;
import javax.persistence.CollectionTable;
import javax.persistence.Column;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.loader;
package org.hibernate.test.loadplans.process;
import javax.persistence.CascadeType;
import javax.persistence.Entity;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.loader;
package org.hibernate.test.loadplans.process;
import javax.persistence.CascadeType;
import javax.persistence.Entity;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.loader;
package org.hibernate.test.loadplans.process;
import org.hibernate.LockMode;
import org.hibernate.LockOptions;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.loader;
package org.hibernate.test.loadplans.process;
import java.sql.Connection;
import java.sql.PreparedStatement;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.loader;
package org.hibernate.test.loadplans.process;
import javax.persistence.Entity;
import javax.persistence.Id;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.walking;
package org.hibernate.test.loadplans.walking;
import javax.persistence.Entity;
import javax.persistence.Id;

View File

@ -0,0 +1,52 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2013, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.loadplans.walking;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.walking.spi.MetamodelGraphWalker;
import org.junit.Test;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import org.hibernate.test.annotations.collectionelement.TestCourse;
/**
* @author Steve Ebersole
*/
public class CompositesWalkingTest extends BaseUnitTestCase {
/**
* Test one-level composites defined as part of an entity.
*/
@Test
public void testEntityComposite() {
final SessionFactory sf = new Configuration()
.addAnnotatedClass( TestCourse.class )
.buildSessionFactory();
final EntityPersister ep = (EntityPersister) sf.getClassMetadata( TestCourse.class );
MetamodelGraphWalker.visitEntity( new LoggingAssociationVisitationStrategy(), ep );
}
}

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.walking;
package org.hibernate.test.loadplans.walking;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.walking.spi.MetamodelGraphWalker;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.walking;
package org.hibernate.test.loadplans.walking;
import org.hibernate.annotations.common.util.StringHelper;
import org.hibernate.persister.walking.spi.AnyMappingDefinition;
@ -41,7 +41,7 @@ import org.hibernate.persister.walking.spi.EntityIdentifierDefinition;
* @author Steve Ebersole
*/
public class LoggingAssociationVisitationStrategy implements AssociationVisitationStrategy {
private int depth = 0;
private int depth = 1;
@Override
public void start() {
@ -176,7 +176,7 @@ public class LoggingAssociationVisitationStrategy implements AssociationVisitati
System.out.println(
String.format(
"%s Finishing collection index (%s)",
StringHelper.repeat( ">>", ++depth ),
StringHelper.repeat( "<<", depth-- ),
collectionIndexDefinition.getCollectionDefinition().getCollectionPersister().getRole()
)
);
@ -198,7 +198,7 @@ public class LoggingAssociationVisitationStrategy implements AssociationVisitati
System.out.println(
String.format(
"%s Finishing collection elements (%s)",
StringHelper.repeat( ">>", ++depth ),
StringHelper.repeat( "<<", depth-- ),
elementDefinition.getCollectionDefinition().getCollectionPersister().getRole()
)
);
@ -223,7 +223,7 @@ public class LoggingAssociationVisitationStrategy implements AssociationVisitati
System.out.println(
String.format(
"%s Finishing composite (%s)",
StringHelper.repeat( ">>", depth-- ),
StringHelper.repeat( "<<", depth-- ),
compositionElementDefinition.getCollectionDefinition().getCollectionPersister().getRole()
)
);