Skip to content

Commit

Permalink
HHH-7841 - Redesign Loader
Browse files Browse the repository at this point in the history
  • Loading branch information
sebersole committed Apr 11, 2013
1 parent c75dafb commit 3d33237
Show file tree
Hide file tree
Showing 76 changed files with 3,725 additions and 427 deletions.
43 changes: 43 additions & 0 deletions hibernate-core/src/main/java/org/hibernate/HibernateError.java
@@ -0,0 +1,43 @@
/*
* 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;

/**
* Marks a group of exceptions that generally indicate an internal Hibernate error or bug.
*
* @author Steve Ebersole
*/
public abstract class HibernateError extends HibernateException {
public HibernateError(String message) {
super( message );
}

public HibernateError(Throwable root) {
super( root );
}

public HibernateError(String message, Throwable root) {
super( message, root );
}
}
Expand Up @@ -63,6 +63,7 @@
import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.loader.BasicLoader;
import org.hibernate.loader.spi.AfterLoadAction;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.collection.QueryableCollection;
import org.hibernate.persister.entity.Loadable;
Expand Down
9 changes: 3 additions & 6 deletions hibernate-core/src/main/java/org/hibernate/loader/Loader.java
Expand Up @@ -79,6 +79,7 @@
import org.hibernate.internal.FetchingScrollableResultsImpl;
import org.hibernate.internal.ScrollableResultsImpl;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.loader.spi.AfterLoadAction;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.Loadable;
Expand Down Expand Up @@ -245,10 +246,6 @@ protected String preprocessSQL(
: sql;
}

protected static interface AfterLoadAction {
public void afterLoad(SessionImplementor session, Object entity, Loadable persister);
}

protected boolean shouldUseFollowOnLocking(
QueryParameters parameters,
Dialect dialect,
Expand Down Expand Up @@ -509,7 +506,7 @@ public Object loadSequentialRowsForward(
}

// We call getKeyFromResultSet() here so that we can know the
// key value upon which to doAfterTransactionCompletion the breaking logic. However,
// key value upon which to perform the breaking logic. However,
// it is also then called from getRowFromResultSet() which is certainly
// not the most efficient. But the call here is needed, and there
// currently is no other way without refactoring of the doQuery()/getRowFromResultSet()
Expand All @@ -527,7 +524,7 @@ public Object loadSequentialRowsForward(
catch ( SQLException sqle ) {
throw factory.getSQLExceptionHelper().convert(
sqle,
"could not doAfterTransactionCompletion sequential read of results (forward)",
"could not perform sequential read of results (forward)",
getSQLString()
);
}
Expand Down
Expand Up @@ -43,6 +43,7 @@
import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.loader.JoinWalker;
import org.hibernate.loader.Loader;
import org.hibernate.loader.spi.AfterLoadAction;
import org.hibernate.persister.collection.QueryableCollection;
import org.hibernate.pretty.MessageHelper;
import org.hibernate.type.Type;
Expand Down
Expand Up @@ -45,6 +45,7 @@
import org.hibernate.internal.CriteriaImpl;
import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.loader.OuterJoinLoader;
import org.hibernate.loader.spi.AfterLoadAction;
import org.hibernate.persister.entity.Loadable;
import org.hibernate.persister.entity.Lockable;
import org.hibernate.persister.entity.OuterJoinLoadable;
Expand Down
Expand Up @@ -27,7 +27,6 @@
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
Expand All @@ -41,10 +40,7 @@
import org.hibernate.ScrollableResults;
import org.hibernate.Session;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.pagination.LimitHandler;
import org.hibernate.dialect.pagination.LimitHelper;
import org.hibernate.engine.spi.QueryParameters;
import org.hibernate.engine.spi.RowSelection;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.hql.internal.HolderInstantiator;
Expand All @@ -53,10 +49,10 @@
import org.hibernate.loader.CollectionAliases;
import org.hibernate.loader.EntityAliases;
import org.hibernate.loader.Loader;
import org.hibernate.loader.spi.AfterLoadAction;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.collection.QueryableCollection;
import org.hibernate.persister.entity.Loadable;
import org.hibernate.persister.entity.Lockable;
import org.hibernate.persister.entity.Queryable;
import org.hibernate.transform.ResultTransformer;
import org.hibernate.type.CollectionType;
Expand Down
Expand Up @@ -43,6 +43,7 @@
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.loader.spi.AfterLoadAction;
import org.hibernate.persister.entity.OuterJoinLoadable;
import org.hibernate.pretty.MessageHelper;

Expand Down
Expand Up @@ -52,6 +52,7 @@
import org.hibernate.internal.IteratorImpl;
import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.loader.BasicLoader;
import org.hibernate.loader.spi.AfterLoadAction;
import org.hibernate.param.ParameterSpecification;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.collection.QueryableCollection;
Expand Down
@@ -0,0 +1,58 @@
/*
* 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.loader.internal;

import java.sql.ResultSet;

import org.hibernate.engine.spi.QueryParameters;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.loader.spi.OnDemandResultSetProcessor;

/**
* @author Steve Ebersole
*/
public class OnDemandResultSetProcessorImpl implements OnDemandResultSetProcessor {
@Override
public Object extractSingleRow(
ResultSet resultSet,
SessionImplementor session,
QueryParameters queryParameters) {
return null;
}

@Override
public Object extractSequentialRowsForward(
ResultSet resultSet, SessionImplementor session, QueryParameters queryParameters) {
return null; //To change body of implemented methods use File | Settings | File Templates.
}

@Override
public Object extractSequentialRowsReverse(
ResultSet resultSet,
SessionImplementor session,
QueryParameters queryParameters,
boolean isLogicallyAfterLast) {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
}

0 comments on commit 3d33237

Please sign in to comment.