Skip to content

Commit 1acd1e5

Browse files
committed
initial HEM->CORE consolidation work
1 parent 3d04839 commit 1acd1e5

File tree

274 files changed

+3513
-2368
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

274 files changed

+3513
-2368
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Hibernate, Relational Persistence for Idiomatic Java
3+
*
4+
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
5+
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
6+
*/
7+
package org.hibernate;
8+
9+
import javax.persistence.metamodel.EntityType;
10+
import javax.persistence.metamodel.Metamodel;
11+
12+
/**
13+
* @author Steve Ebersole
14+
*/
15+
public interface Metamodel extends javax.persistence.metamodel.Metamodel {
16+
EntityType getEntityTypeByName(String entityName);
17+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.hibernate.engine.spi;
2+
3+
/**
4+
* @author Steve Ebersole
5+
*/
6+
public interface SharedSessionContractImplementor {
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.hibernate.engine.transaction.spi;
2+
3+
/**
4+
* @author Steve Ebersole
5+
*/
6+
public interface TransactionImplementor {
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.hibernate.graph.spi;
2+
3+
/**
4+
* @author Steve Ebersole
5+
*/
6+
public interface EntityGraphImplementor {
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.hibernate.internal;
2+
3+
/**
4+
* @author Steve Ebersole
5+
*/
6+
public class AbstractSharedSessionContract {
7+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package org.hibernate.internal;
2+
3+
import java.io.Serializable;
4+
import java.sql.Connection;
5+
import java.sql.SQLException;
6+
7+
import org.hibernate.HibernateException;
8+
import org.hibernate.SessionEventListener;
9+
import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
10+
import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider;
11+
12+
/**
13+
* @author Steve Ebersole
14+
*/
15+
class ContextualJdbcConnectionAccess implements JdbcConnectionAccess, Serializable {
16+
private AbstractSessionImpl abstractSession;
17+
private final SessionEventListener listener;
18+
private final MultiTenantConnectionProvider connectionProvider;
19+
20+
ContextualJdbcConnectionAccess(
21+
AbstractSessionImpl abstractSession,
22+
SessionEventListener listener,
23+
MultiTenantConnectionProvider connectionProvider) {
24+
this.abstractSession = abstractSession;
25+
this.listener = listener;
26+
this.connectionProvider = connectionProvider;
27+
}
28+
29+
@Override
30+
public Connection obtainConnection() throws SQLException {
31+
if ( abstractSession.tenantIdentifier == null ) {
32+
throw new HibernateException( "Tenant identifier required!" );
33+
}
34+
35+
try {
36+
listener.jdbcConnectionAcquisitionStart();
37+
return connectionProvider.getConnection( abstractSession.tenantIdentifier );
38+
}
39+
finally {
40+
listener.jdbcConnectionAcquisitionEnd();
41+
}
42+
}
43+
44+
@Override
45+
public void releaseConnection(Connection connection) throws SQLException {
46+
if ( abstractSession.tenantIdentifier == null ) {
47+
throw new HibernateException( "Tenant identifier required!" );
48+
}
49+
50+
try {
51+
listener.jdbcConnectionReleaseStart();
52+
connectionProvider.releaseConnection( abstractSession.tenantIdentifier, connection );
53+
}
54+
finally {
55+
listener.jdbcConnectionReleaseEnd();
56+
}
57+
}
58+
59+
@Override
60+
public boolean supportsAggressiveRelease() {
61+
return connectionProvider.supportsAggressiveRelease();
62+
}
63+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package org.hibernate.internal;
2+
3+
import org.hibernate.EntityNameResolver;
4+
import org.hibernate.Interceptor;
5+
import org.hibernate.engine.spi.SessionFactoryImplementor;
6+
7+
/**
8+
* @author Steve Ebersole
9+
*/
10+
public class CoordinatingEntityNameResolver implements EntityNameResolver {
11+
private final SessionFactoryImplementor sessionFactory;
12+
private final Interceptor interceptor;
13+
14+
public CoordinatingEntityNameResolver(SessionFactoryImplementor sessionFactory, Interceptor interceptor) {
15+
this.sessionFactory = sessionFactory;
16+
this.interceptor = interceptor;
17+
}
18+
19+
@Override
20+
public String resolveEntityName(Object entity) {
21+
String entityName = interceptor.getEntityName( entity );
22+
if ( entityName != null ) {
23+
return entityName;
24+
}
25+
26+
for ( EntityNameResolver resolver : sessionFactory.iterateEntityNameResolvers() ) {
27+
entityName = resolver.resolveEntityName( entity );
28+
if ( entityName != null ) {
29+
break;
30+
}
31+
}
32+
33+
if ( entityName != null ) {
34+
return entityName;
35+
}
36+
37+
// the old-time stand-by...
38+
return entity.getClass().getName();
39+
}
40+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
55
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
66
*/
7-
package org.hibernate.jpa.internal;
7+
package org.hibernate.internal;
88

99
import java.net.URISyntaxException;
1010
import java.net.URL;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package org.hibernate.internal;
2+
3+
import javax.transaction.SystemException;
4+
5+
import org.hibernate.TransactionException;
6+
import org.hibernate.engine.spi.SessionImplementor;
7+
import org.hibernate.resource.transaction.backend.jta.internal.synchronization.ExceptionMapper;
8+
9+
/**
10+
* @author Steve Ebersole
11+
*/
12+
public class ExceptionMapperStandardImpl implements ExceptionMapper {
13+
public static final ExceptionMapper INSTANCE = new ExceptionMapperStandardImpl();
14+
15+
@Override
16+
public RuntimeException mapStatusCheckFailure(
17+
String message,
18+
SystemException systemException,
19+
SessionImplementor sessionImplementor) {
20+
return new TransactionException(
21+
"could not determine transaction status in beforeCompletion()",
22+
systemException
23+
);
24+
}
25+
26+
@Override
27+
public RuntimeException mapManagedFlushFailure(
28+
String message,
29+
RuntimeException failure,
30+
SessionImplementor session) {
31+
SessionImpl.log.unableToPerformManagedFlush( failure.getMessage() );
32+
return failure;
33+
}
34+
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
55
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
66
*/
7-
package org.hibernate.jpa.internal;
7+
package org.hibernate.internal;
8+
9+
import org.hibernate.internal.EntityManagerMessageLogger;
810

911
import org.jboss.logging.Logger;
1012

0 commit comments

Comments
 (0)