HHH-7451 - Integrate Draft 7 of the JPA 2.1 spec : more ejb->jpa rename
This commit is contained in:
parent
6a65c3e7e6
commit
06d44951c6
|
@ -1,72 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2009, Red Hat Middleware LLC 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 Middleware LLC.
|
|
||||||
*
|
|
||||||
* 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.ejb.connection;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.Properties;
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
|
||||||
import org.hibernate.cfg.Environment;
|
|
||||||
import org.hibernate.jpa.internal.EntityManagerMessageLogger;
|
|
||||||
import org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A specialization of {@link DatasourceConnectionProviderImpl} which uses the {@link DataSource} specified vi
|
|
||||||
* {@link #setDataSource} rather than locating it from JNDI.
|
|
||||||
* <p/>
|
|
||||||
* NOTE : {@link #setDataSource} must be called prior to {@link #configure}.
|
|
||||||
* <p/>
|
|
||||||
* TODO : could not find where #setDataSource is actually called. Can't this just be passed in to #configure???
|
|
||||||
*
|
|
||||||
* @author Emmanuel Bernard
|
|
||||||
*/
|
|
||||||
public class InjectedDataSourceConnectionProvider extends DatasourceConnectionProviderImpl {
|
|
||||||
|
|
||||||
private static final EntityManagerMessageLogger LOG = Logger.getMessageLogger(EntityManagerMessageLogger.class,
|
|
||||||
InjectedDataSourceConnectionProvider.class.getName());
|
|
||||||
|
|
||||||
private String user;
|
|
||||||
private String pass;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setDataSource(DataSource ds) {
|
|
||||||
super.setDataSource( ds );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void configure(Properties props) throws HibernateException {
|
|
||||||
user = props.getProperty( Environment.USER );
|
|
||||||
pass = props.getProperty( Environment.PASS );
|
|
||||||
|
|
||||||
if (getDataSource() == null) throw new HibernateException("No datasource provided");
|
|
||||||
LOG.usingProvidedDataSource();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Connection getConnection() throws SQLException {
|
|
||||||
if (user != null || pass != null) return getDataSource().getConnection(user, pass);
|
|
||||||
return getDataSource().getConnection();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009-2012, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* 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
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -22,23 +24,23 @@
|
||||||
package org.hibernate.engine.spi;
|
package org.hibernate.engine.spi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Becasue CascadeStyle is not opened and package protected,
|
* Because CascadeStyle is not opened and package protected,
|
||||||
* I need to subclass and override the persist alias
|
* I need to subclass and override the persist alias
|
||||||
*
|
*
|
||||||
* Note that This class has to be triggered by EJB3PersistEventListener at class loading time
|
* Note that This class has to be triggered by JpaPersistEventListener at class loading time
|
||||||
*
|
*
|
||||||
* TODO get rid of it for 3.3
|
* TODO get rid of it for 3.3
|
||||||
*
|
*
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
*/
|
*/
|
||||||
public abstract class EJB3CascadeStyle extends CascadeStyle {
|
public abstract class JpaCascadeStyle extends CascadeStyle {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cascade using EJB3CascadingAction
|
* cascade using JpaCascadingAction
|
||||||
*/
|
*/
|
||||||
public static final CascadeStyle PERSIST_EJB3 = new CascadeStyle() {
|
public static final CascadeStyle PERSIST_JPA = new CascadeStyle() {
|
||||||
public boolean doCascade(CascadingAction action) {
|
public boolean doCascade(CascadingAction action) {
|
||||||
return action== EJB3CascadingAction.PERSIST_SKIPLAZY
|
return action== JpaCascadingAction.PERSIST_SKIPLAZY
|
||||||
|| action==CascadingAction.PERSIST_ON_FLUSH;
|
|| action==CascadingAction.PERSIST_ON_FLUSH;
|
||||||
}
|
}
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -47,6 +49,6 @@ public abstract class EJB3CascadeStyle extends CascadeStyle {
|
||||||
};
|
};
|
||||||
|
|
||||||
static {
|
static {
|
||||||
STYLES.put( "persist", PERSIST_EJB3 );
|
STYLES.put( "persist", PERSIST_JPA );
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -27,7 +27,6 @@ import java.util.Map;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.jpa.internal.EntityManagerMessageLogger;
|
|
||||||
import org.hibernate.event.spi.EventSource;
|
import org.hibernate.event.spi.EventSource;
|
||||||
import org.hibernate.type.CollectionType;
|
import org.hibernate.type.CollectionType;
|
||||||
|
|
||||||
|
@ -37,10 +36,9 @@ import org.hibernate.type.CollectionType;
|
||||||
* TODO Get rid of it for 3.3
|
* TODO Get rid of it for 3.3
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
*/
|
*/
|
||||||
public abstract class EJB3CascadingAction extends CascadingAction {
|
public abstract class JpaCascadingAction extends CascadingAction {
|
||||||
|
private static final Logger LOG = Logger.getLogger( JpaCascadingAction.class.getName() );
|
||||||
|
|
||||||
private static final EntityManagerMessageLogger LOG = Logger.getMessageLogger(EntityManagerMessageLogger.class,
|
|
||||||
EJB3CascadingAction.class.getName());
|
|
||||||
/**
|
/**
|
||||||
* @see org.hibernate.Session#persist(Object)
|
* @see org.hibernate.Session#persist(Object)
|
||||||
*/
|
*/
|
|
@ -53,7 +53,7 @@ import org.xml.sax.InputSource;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.SAXParseException;
|
import org.xml.sax.SAXParseException;
|
||||||
|
|
||||||
import org.hibernate.ejb.AvailableSettings;
|
import org.hibernate.jpa.AvailableSettings;
|
||||||
import org.hibernate.jpa.internal.EntityManagerMessageLogger;
|
import org.hibernate.jpa.internal.EntityManagerMessageLogger;
|
||||||
import org.hibernate.jpa.packaging.internal.JarVisitorFactory;
|
import org.hibernate.jpa.packaging.internal.JarVisitorFactory;
|
||||||
import org.hibernate.jpa.internal.util.ConfigurationHelper;
|
import org.hibernate.jpa.internal.util.ConfigurationHelper;
|
||||||
|
@ -397,7 +397,7 @@ public class PersistenceXmlParser {
|
||||||
|
|
||||||
private Schema v2Schema() {
|
private Schema v2Schema() {
|
||||||
if ( v2Schema == null ) {
|
if ( v2Schema == null ) {
|
||||||
v2Schema = resolveLocalSchema( "org/hibernate/ejb/persistence_2_0.xsd" );
|
v2Schema = resolveLocalSchema( "org/hibernate/jpa/persistence_2_0.xsd" );
|
||||||
}
|
}
|
||||||
return v2Schema;
|
return v2Schema;
|
||||||
}
|
}
|
||||||
|
@ -406,7 +406,7 @@ public class PersistenceXmlParser {
|
||||||
|
|
||||||
private Schema v1Schema() {
|
private Schema v1Schema() {
|
||||||
if ( v1Schema == null ) {
|
if ( v1Schema == null ) {
|
||||||
v1Schema = resolveLocalSchema( "org/hibernate/ejb/persistence_1_0.xsd" );
|
v1Schema = resolveLocalSchema( "org/hibernate/jpa/persistence_1_0.xsd" );
|
||||||
}
|
}
|
||||||
return v1Schema;
|
return v1Schema;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,16 +35,18 @@ import org.hibernate.event.spi.AutoFlushEventListener;
|
||||||
*
|
*
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
public class EJB3AutoFlushEventListener
|
public class JpaAutoFlushEventListener
|
||||||
extends DefaultAutoFlushEventListener
|
extends DefaultAutoFlushEventListener
|
||||||
implements HibernateEntityManagerEventListener {
|
implements HibernateEntityManagerEventListener {
|
||||||
|
|
||||||
public static final AutoFlushEventListener INSTANCE = new EJB3AutoFlushEventListener();
|
public static final AutoFlushEventListener INSTANCE = new JpaAutoFlushEventListener();
|
||||||
|
|
||||||
|
@Override
|
||||||
protected CascadingAction getCascadingAction() {
|
protected CascadingAction getCascadingAction() {
|
||||||
return CascadingAction.PERSIST_ON_FLUSH;
|
return CascadingAction.PERSIST_ON_FLUSH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected Object getAnything() {
|
protected Object getAnything() {
|
||||||
return new IdentityHashMap( 10 );
|
return new IdentityHashMap( 10 );
|
||||||
}
|
}
|
|
@ -35,18 +35,18 @@ import org.hibernate.persister.entity.EntityPersister;
|
||||||
*
|
*
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
*/
|
*/
|
||||||
public class EJB3DeleteEventListener extends DefaultDeleteEventListener implements CallbackHandlerConsumer {
|
public class JpaDeleteEventListener extends DefaultDeleteEventListener implements CallbackHandlerConsumer {
|
||||||
private EntityCallbackHandler callbackHandler;
|
private EntityCallbackHandler callbackHandler;
|
||||||
|
|
||||||
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3DeleteEventListener() {
|
public JpaDeleteEventListener() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3DeleteEventListener(EntityCallbackHandler callbackHandler) {
|
public JpaDeleteEventListener(EntityCallbackHandler callbackHandler) {
|
||||||
this();
|
this();
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
|
@ -37,18 +37,18 @@ import org.hibernate.type.Type;
|
||||||
*
|
*
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
*/
|
*/
|
||||||
public class EJB3FlushEntityEventListener extends DefaultFlushEntityEventListener implements CallbackHandlerConsumer {
|
public class JpaFlushEntityEventListener extends DefaultFlushEntityEventListener implements CallbackHandlerConsumer {
|
||||||
private EntityCallbackHandler callbackHandler;
|
private EntityCallbackHandler callbackHandler;
|
||||||
|
|
||||||
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3FlushEntityEventListener() {
|
public JpaFlushEntityEventListener() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3FlushEntityEventListener(EntityCallbackHandler callbackHandler) {
|
public JpaFlushEntityEventListener(EntityCallbackHandler callbackHandler) {
|
||||||
super();
|
super();
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
|
@ -30,19 +30,20 @@ import org.hibernate.event.internal.DefaultFlushEventListener;
|
||||||
import org.hibernate.event.spi.FlushEventListener;
|
import org.hibernate.event.spi.FlushEventListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In EJB3, it is the create operation that is cascaded to unmanaged entities at flush time (instead of the
|
* In JPA, it is the create operation that is cascaded to unmanaged entities at flush time (instead of the
|
||||||
* save-update operation in Hibernate).
|
* save-update operation in Hibernate).
|
||||||
*
|
*
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
public class EJB3FlushEventListener extends DefaultFlushEventListener implements HibernateEntityManagerEventListener {
|
public class JpaFlushEventListener extends DefaultFlushEventListener implements HibernateEntityManagerEventListener {
|
||||||
|
public static final FlushEventListener INSTANCE = new JpaFlushEventListener();
|
||||||
public static final FlushEventListener INSTANCE = new EJB3FlushEventListener();
|
|
||||||
|
|
||||||
|
@Override
|
||||||
protected CascadingAction getCascadingAction() {
|
protected CascadingAction getCascadingAction() {
|
||||||
return CascadingAction.PERSIST_ON_FLUSH;
|
return CascadingAction.PERSIST_ON_FLUSH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected Object getAnything() {
|
protected Object getAnything() {
|
||||||
return new IdentityHashMap( 10 );
|
return new IdentityHashMap( 10 );
|
||||||
}
|
}
|
|
@ -97,15 +97,15 @@ public class JpaIntegrator implements Integrator {
|
||||||
eventListenerRegistry.addDuplicationStrategy( JACC_DUPLICATION_STRATEGY );
|
eventListenerRegistry.addDuplicationStrategy( JACC_DUPLICATION_STRATEGY );
|
||||||
|
|
||||||
// op listeners
|
// op listeners
|
||||||
eventListenerRegistry.setListeners( EventType.AUTO_FLUSH, EJB3AutoFlushEventListener.INSTANCE );
|
eventListenerRegistry.setListeners( EventType.AUTO_FLUSH, JpaAutoFlushEventListener.INSTANCE );
|
||||||
eventListenerRegistry.setListeners( EventType.DELETE, new EJB3DeleteEventListener() );
|
eventListenerRegistry.setListeners( EventType.DELETE, new JpaDeleteEventListener() );
|
||||||
eventListenerRegistry.setListeners( EventType.FLUSH_ENTITY, new EJB3FlushEntityEventListener() );
|
eventListenerRegistry.setListeners( EventType.FLUSH_ENTITY, new JpaFlushEntityEventListener() );
|
||||||
eventListenerRegistry.setListeners( EventType.FLUSH, EJB3FlushEventListener.INSTANCE );
|
eventListenerRegistry.setListeners( EventType.FLUSH, JpaFlushEventListener.INSTANCE );
|
||||||
eventListenerRegistry.setListeners( EventType.MERGE, new EJB3MergeEventListener() );
|
eventListenerRegistry.setListeners( EventType.MERGE, new JpaMergeEventListener() );
|
||||||
eventListenerRegistry.setListeners( EventType.PERSIST, new EJB3PersistEventListener() );
|
eventListenerRegistry.setListeners( EventType.PERSIST, new JpaPersistEventListener() );
|
||||||
eventListenerRegistry.setListeners( EventType.PERSIST_ONFLUSH, new EJB3PersistOnFlushEventListener() );
|
eventListenerRegistry.setListeners( EventType.PERSIST_ONFLUSH, new JpaPersistOnFlushEventListener() );
|
||||||
eventListenerRegistry.setListeners( EventType.SAVE, new EJB3SaveEventListener() );
|
eventListenerRegistry.setListeners( EventType.SAVE, new JpaSaveEventListener() );
|
||||||
eventListenerRegistry.setListeners( EventType.SAVE_UPDATE, new EJB3SaveOrUpdateEventListener() );
|
eventListenerRegistry.setListeners( EventType.SAVE_UPDATE, new JpaSaveOrUpdateEventListener() );
|
||||||
|
|
||||||
// pre op listeners
|
// pre op listeners
|
||||||
if ( isSecurityEnabled ) {
|
if ( isSecurityEnabled ) {
|
||||||
|
@ -117,10 +117,10 @@ public class JpaIntegrator implements Integrator {
|
||||||
}
|
}
|
||||||
|
|
||||||
// post op listeners
|
// post op listeners
|
||||||
eventListenerRegistry.prependListeners( EventType.POST_DELETE, new EJB3PostDeleteEventListener() );
|
eventListenerRegistry.prependListeners( EventType.POST_DELETE, new JpaPostDeleteEventListener() );
|
||||||
eventListenerRegistry.prependListeners( EventType.POST_INSERT, new EJB3PostInsertEventListener() );
|
eventListenerRegistry.prependListeners( EventType.POST_INSERT, new JpaPostInsertEventListener() );
|
||||||
eventListenerRegistry.prependListeners( EventType.POST_LOAD, new EJB3PostLoadEventListener() );
|
eventListenerRegistry.prependListeners( EventType.POST_LOAD, new JpaPostLoadEventListener() );
|
||||||
eventListenerRegistry.prependListeners( EventType.POST_UPDATE, new EJB3PostUpdateEventListener() );
|
eventListenerRegistry.prependListeners( EventType.POST_UPDATE, new JpaPostUpdateEventListener() );
|
||||||
|
|
||||||
for ( Map.Entry<?,?> entry : configuration.getProperties().entrySet() ) {
|
for ( Map.Entry<?,?> entry : configuration.getProperties().entrySet() ) {
|
||||||
if ( ! String.class.isInstance( entry.getKey() ) ) {
|
if ( ! String.class.isInstance( entry.getKey() ) ) {
|
||||||
|
@ -182,15 +182,15 @@ public class JpaIntegrator implements Integrator {
|
||||||
eventListenerRegistry.addDuplicationStrategy( JACC_DUPLICATION_STRATEGY );
|
eventListenerRegistry.addDuplicationStrategy( JACC_DUPLICATION_STRATEGY );
|
||||||
|
|
||||||
// op listeners
|
// op listeners
|
||||||
eventListenerRegistry.setListeners( EventType.AUTO_FLUSH, EJB3AutoFlushEventListener.INSTANCE );
|
eventListenerRegistry.setListeners( EventType.AUTO_FLUSH, JpaAutoFlushEventListener.INSTANCE );
|
||||||
eventListenerRegistry.setListeners( EventType.DELETE, new EJB3DeleteEventListener() );
|
eventListenerRegistry.setListeners( EventType.DELETE, new JpaDeleteEventListener() );
|
||||||
eventListenerRegistry.setListeners( EventType.FLUSH_ENTITY, new EJB3FlushEntityEventListener() );
|
eventListenerRegistry.setListeners( EventType.FLUSH_ENTITY, new JpaFlushEntityEventListener() );
|
||||||
eventListenerRegistry.setListeners( EventType.FLUSH, EJB3FlushEventListener.INSTANCE );
|
eventListenerRegistry.setListeners( EventType.FLUSH, JpaFlushEventListener.INSTANCE );
|
||||||
eventListenerRegistry.setListeners( EventType.MERGE, new EJB3MergeEventListener() );
|
eventListenerRegistry.setListeners( EventType.MERGE, new JpaMergeEventListener() );
|
||||||
eventListenerRegistry.setListeners( EventType.PERSIST, new EJB3PersistEventListener() );
|
eventListenerRegistry.setListeners( EventType.PERSIST, new JpaPersistEventListener() );
|
||||||
eventListenerRegistry.setListeners( EventType.PERSIST_ONFLUSH, new EJB3PersistOnFlushEventListener() );
|
eventListenerRegistry.setListeners( EventType.PERSIST_ONFLUSH, new JpaPersistOnFlushEventListener() );
|
||||||
eventListenerRegistry.setListeners( EventType.SAVE, new EJB3SaveEventListener() );
|
eventListenerRegistry.setListeners( EventType.SAVE, new JpaSaveEventListener() );
|
||||||
eventListenerRegistry.setListeners( EventType.SAVE_UPDATE, new EJB3SaveOrUpdateEventListener() );
|
eventListenerRegistry.setListeners( EventType.SAVE_UPDATE, new JpaSaveOrUpdateEventListener() );
|
||||||
|
|
||||||
// pre op listeners
|
// pre op listeners
|
||||||
if ( isSecurityEnabled ) {
|
if ( isSecurityEnabled ) {
|
||||||
|
@ -202,10 +202,10 @@ public class JpaIntegrator implements Integrator {
|
||||||
}
|
}
|
||||||
|
|
||||||
// post op listeners
|
// post op listeners
|
||||||
eventListenerRegistry.prependListeners( EventType.POST_DELETE, new EJB3PostDeleteEventListener() );
|
eventListenerRegistry.prependListeners( EventType.POST_DELETE, new JpaPostDeleteEventListener() );
|
||||||
eventListenerRegistry.prependListeners( EventType.POST_INSERT, new EJB3PostInsertEventListener() );
|
eventListenerRegistry.prependListeners( EventType.POST_INSERT, new JpaPostInsertEventListener() );
|
||||||
eventListenerRegistry.prependListeners( EventType.POST_LOAD, new EJB3PostLoadEventListener() );
|
eventListenerRegistry.prependListeners( EventType.POST_LOAD, new JpaPostLoadEventListener() );
|
||||||
eventListenerRegistry.prependListeners( EventType.POST_UPDATE, new EJB3PostUpdateEventListener() );
|
eventListenerRegistry.prependListeners( EventType.POST_UPDATE, new JpaPostUpdateEventListener() );
|
||||||
|
|
||||||
for ( Map.Entry<?,?> entry : sessionFactory.getProperties().entrySet() ) {
|
for ( Map.Entry<?,?> entry : sessionFactory.getProperties().entrySet() ) {
|
||||||
if ( ! String.class.isInstance( entry.getKey() ) ) {
|
if ( ! String.class.isInstance( entry.getKey() ) ) {
|
||||||
|
|
|
@ -33,18 +33,18 @@ import org.hibernate.event.spi.EventSource;
|
||||||
*
|
*
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
*/
|
*/
|
||||||
public class EJB3MergeEventListener extends DefaultMergeEventListener implements CallbackHandlerConsumer {
|
public class JpaMergeEventListener extends DefaultMergeEventListener implements CallbackHandlerConsumer {
|
||||||
private EntityCallbackHandler callbackHandler;
|
private EntityCallbackHandler callbackHandler;
|
||||||
|
|
||||||
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3MergeEventListener() {
|
public JpaMergeEventListener() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3MergeEventListener(EntityCallbackHandler callbackHandler) {
|
public JpaMergeEventListener(EntityCallbackHandler callbackHandler) {
|
||||||
super();
|
super();
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
|
@ -26,8 +26,8 @@ package org.hibernate.jpa.internal.event;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import org.hibernate.engine.spi.CascadingAction;
|
import org.hibernate.engine.spi.CascadingAction;
|
||||||
import org.hibernate.engine.spi.EJB3CascadeStyle;
|
import org.hibernate.engine.spi.JpaCascadeStyle;
|
||||||
import org.hibernate.engine.spi.EJB3CascadingAction;
|
import org.hibernate.engine.spi.JpaCascadingAction;
|
||||||
import org.hibernate.event.internal.DefaultPersistEventListener;
|
import org.hibernate.event.internal.DefaultPersistEventListener;
|
||||||
import org.hibernate.event.spi.EventSource;
|
import org.hibernate.event.spi.EventSource;
|
||||||
|
|
||||||
|
@ -36,22 +36,23 @@ import org.hibernate.event.spi.EventSource;
|
||||||
*
|
*
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
*/
|
*/
|
||||||
public class EJB3PersistEventListener extends DefaultPersistEventListener implements CallbackHandlerConsumer {
|
public class JpaPersistEventListener extends DefaultPersistEventListener implements CallbackHandlerConsumer {
|
||||||
static {
|
static {
|
||||||
EJB3CascadeStyle.PERSIST_EJB3.hasOrphanDelete(); //triggers class loading to override persist with PERSIST_EJB3
|
JpaCascadeStyle.PERSIST_JPA.hasOrphanDelete(); //triggers class loading to override persist with PERSIST_JPA
|
||||||
}
|
}
|
||||||
|
|
||||||
private EntityCallbackHandler callbackHandler;
|
private EntityCallbackHandler callbackHandler;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3PersistEventListener() {
|
public JpaPersistEventListener() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3PersistEventListener(EntityCallbackHandler callbackHandler) {
|
public JpaPersistEventListener(EntityCallbackHandler callbackHandler) {
|
||||||
super();
|
super();
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
||||||
|
@ -80,6 +81,6 @@ public class EJB3PersistEventListener extends DefaultPersistEventListener implem
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CascadingAction getCascadeAction() {
|
protected CascadingAction getCascadeAction() {
|
||||||
return EJB3CascadingAction.PERSIST_SKIPLAZY;
|
return JpaCascadingAction.PERSIST_SKIPLAZY;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -28,7 +28,7 @@ import org.hibernate.engine.spi.CascadingAction;
|
||||||
/**
|
/**
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
*/
|
*/
|
||||||
public class EJB3PersistOnFlushEventListener extends EJB3PersistEventListener {
|
public class JpaPersistOnFlushEventListener extends JpaPersistEventListener {
|
||||||
@Override
|
@Override
|
||||||
protected CascadingAction getCascadeAction() {
|
protected CascadingAction getCascadeAction() {
|
||||||
return CascadingAction.PERSIST_ON_FLUSH;
|
return CascadingAction.PERSIST_ON_FLUSH;
|
|
@ -29,18 +29,18 @@ import org.hibernate.event.spi.PostDeleteEventListener;
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:kabir.khan@jboss.org">Kabir Khan</a>
|
* @author <a href="mailto:kabir.khan@jboss.org">Kabir Khan</a>
|
||||||
*/
|
*/
|
||||||
public class EJB3PostDeleteEventListener implements PostDeleteEventListener, CallbackHandlerConsumer {
|
public class JpaPostDeleteEventListener implements PostDeleteEventListener, CallbackHandlerConsumer {
|
||||||
EntityCallbackHandler callbackHandler;
|
EntityCallbackHandler callbackHandler;
|
||||||
|
|
||||||
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3PostDeleteEventListener() {
|
public JpaPostDeleteEventListener() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3PostDeleteEventListener(EntityCallbackHandler callbackHandler) {
|
public JpaPostDeleteEventListener(EntityCallbackHandler callbackHandler) {
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,21 +29,23 @@ import org.hibernate.event.spi.PostInsertEventListener;
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:kabir.khan@jboss.org">Kabir Khan</a>
|
* @author <a href="mailto:kabir.khan@jboss.org">Kabir Khan</a>
|
||||||
*/
|
*/
|
||||||
public class EJB3PostInsertEventListener implements PostInsertEventListener, CallbackHandlerConsumer {
|
public class JpaPostInsertEventListener implements PostInsertEventListener, CallbackHandlerConsumer {
|
||||||
EntityCallbackHandler callbackHandler;
|
EntityCallbackHandler callbackHandler;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3PostInsertEventListener() {
|
public JpaPostInsertEventListener() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3PostInsertEventListener(EntityCallbackHandler callbackHandler) {
|
public JpaPostInsertEventListener(EntityCallbackHandler callbackHandler) {
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onPostInsert(PostInsertEvent event) {
|
public void onPostInsert(PostInsertEvent event) {
|
||||||
Object entity = event.getEntity();
|
Object entity = event.getEntity();
|
||||||
callbackHandler.postCreate( entity );
|
callbackHandler.postCreate( entity );
|
|
@ -29,21 +29,23 @@ import org.hibernate.event.spi.PostLoadEventListener;
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:kabir.khan@jboss.org">Kabir Khan</a>
|
* @author <a href="mailto:kabir.khan@jboss.org">Kabir Khan</a>
|
||||||
*/
|
*/
|
||||||
public class EJB3PostLoadEventListener implements PostLoadEventListener, CallbackHandlerConsumer {
|
public class JpaPostLoadEventListener implements PostLoadEventListener, CallbackHandlerConsumer {
|
||||||
EntityCallbackHandler callbackHandler;
|
EntityCallbackHandler callbackHandler;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3PostLoadEventListener() {
|
public JpaPostLoadEventListener() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3PostLoadEventListener(EntityCallbackHandler callbackHandler) {
|
public JpaPostLoadEventListener(EntityCallbackHandler callbackHandler) {
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onPostLoad(PostLoadEvent event) {
|
public void onPostLoad(PostLoadEvent event) {
|
||||||
Object entity = event.getEntity();
|
Object entity = event.getEntity();
|
||||||
callbackHandler.postLoad( entity );
|
callbackHandler.postLoad( entity );
|
|
@ -41,7 +41,7 @@ import org.hibernate.event.spi.PostUpdateEventListener;
|
||||||
* @author <a href="mailto:kabir.khan@jboss.org">Kabir Khan</a>
|
* @author <a href="mailto:kabir.khan@jboss.org">Kabir Khan</a>
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class EJB3PostUpdateEventListener
|
public class JpaPostUpdateEventListener
|
||||||
implements PostUpdateEventListener,
|
implements PostUpdateEventListener,
|
||||||
CallbackHandlerConsumer,
|
CallbackHandlerConsumer,
|
||||||
PostCollectionRecreateEventListener,
|
PostCollectionRecreateEventListener,
|
||||||
|
@ -49,18 +49,20 @@ public class EJB3PostUpdateEventListener
|
||||||
PostCollectionUpdateEventListener {
|
PostCollectionUpdateEventListener {
|
||||||
EntityCallbackHandler callbackHandler;
|
EntityCallbackHandler callbackHandler;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3PostUpdateEventListener() {
|
public JpaPostUpdateEventListener() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3PostUpdateEventListener(EntityCallbackHandler callbackHandler) {
|
public JpaPostUpdateEventListener(EntityCallbackHandler callbackHandler) {
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onPostUpdate(PostUpdateEvent event) {
|
public void onPostUpdate(PostUpdateEvent event) {
|
||||||
Object entity = event.getEntity();
|
Object entity = event.getEntity();
|
||||||
EventSource eventSource = event.getSession();
|
EventSource eventSource = event.getSession();
|
||||||
|
@ -76,18 +78,21 @@ public class EJB3PostUpdateEventListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onPostRecreateCollection(PostCollectionRecreateEvent event) {
|
public void onPostRecreateCollection(PostCollectionRecreateEvent event) {
|
||||||
Object entity = event.getCollection().getOwner();
|
Object entity = event.getCollection().getOwner();
|
||||||
EventSource eventSource = event.getSession();
|
EventSource eventSource = event.getSession();
|
||||||
handlePostUpdate(entity, eventSource);
|
handlePostUpdate(entity, eventSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onPostRemoveCollection(PostCollectionRemoveEvent event) {
|
public void onPostRemoveCollection(PostCollectionRemoveEvent event) {
|
||||||
Object entity = event.getCollection().getOwner();
|
Object entity = event.getCollection().getOwner();
|
||||||
EventSource eventSource = event.getSession();
|
EventSource eventSource = event.getSession();
|
||||||
handlePostUpdate(entity, eventSource);
|
handlePostUpdate(entity, eventSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onPostUpdateCollection(PostCollectionUpdateEvent event) {
|
public void onPostUpdateCollection(PostCollectionUpdateEvent event) {
|
||||||
Object entity = event.getCollection().getOwner();
|
Object entity = event.getCollection().getOwner();
|
||||||
EventSource eventSource = event.getSession();
|
EventSource eventSource = event.getSession();
|
|
@ -33,18 +33,18 @@ import org.hibernate.event.spi.EventSource;
|
||||||
*
|
*
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
*/
|
*/
|
||||||
public class EJB3SaveEventListener extends DefaultSaveEventListener implements CallbackHandlerConsumer {
|
public class JpaSaveEventListener extends DefaultSaveEventListener implements CallbackHandlerConsumer {
|
||||||
private EntityCallbackHandler callbackHandler;
|
private EntityCallbackHandler callbackHandler;
|
||||||
|
|
||||||
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3SaveEventListener() {
|
public JpaSaveEventListener() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3SaveEventListener(EntityCallbackHandler callbackHandler) {
|
public JpaSaveEventListener(EntityCallbackHandler callbackHandler) {
|
||||||
super();
|
super();
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
|
@ -33,18 +33,18 @@ import org.hibernate.event.spi.EventSource;
|
||||||
*
|
*
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
*/
|
*/
|
||||||
public class EJB3SaveOrUpdateEventListener extends DefaultSaveOrUpdateEventListener implements CallbackHandlerConsumer {
|
public class JpaSaveOrUpdateEventListener extends DefaultSaveOrUpdateEventListener implements CallbackHandlerConsumer {
|
||||||
private EntityCallbackHandler callbackHandler;
|
private EntityCallbackHandler callbackHandler;
|
||||||
|
|
||||||
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
public void setCallbackHandler(EntityCallbackHandler callbackHandler) {
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3SaveOrUpdateEventListener() {
|
public JpaSaveOrUpdateEventListener() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public EJB3SaveOrUpdateEventListener(EntityCallbackHandler callbackHandler) {
|
public JpaSaveOrUpdateEventListener(EntityCallbackHandler callbackHandler) {
|
||||||
super();
|
super();
|
||||||
this.callbackHandler = callbackHandler;
|
this.callbackHandler = callbackHandler;
|
||||||
}
|
}
|
|
@ -1,260 +1,260 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- persistence.xml schema -->
|
<!-- persistence.xml schema -->
|
||||||
<xsd:schema targetNamespace="http://java.sun.com/xml/ns/persistence"
|
<xsd:schema targetNamespace="http://java.sun.com/xml/ns/persistence"
|
||||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||||
xmlns:persistence="http://java.sun.com/xml/ns/persistence"
|
xmlns:persistence="http://java.sun.com/xml/ns/persistence"
|
||||||
elementFormDefault="qualified"
|
elementFormDefault="qualified"
|
||||||
attributeFormDefault="unqualified"
|
attributeFormDefault="unqualified"
|
||||||
version="1.0">
|
version="1.0">
|
||||||
|
|
||||||
<xsd:annotation>
|
<xsd:annotation>
|
||||||
<xsd:documentation>
|
<xsd:documentation>
|
||||||
@(#)persistence_1_0.xsd 1.0 Feb 9 2006
|
@(#)persistence_1_0.xsd 1.0 Feb 9 2006
|
||||||
</xsd:documentation>
|
</xsd:documentation>
|
||||||
</xsd:annotation>
|
</xsd:annotation>
|
||||||
<xsd:annotation>
|
<xsd:annotation>
|
||||||
<xsd:documentation><![CDATA[
|
<xsd:documentation><![CDATA[
|
||||||
|
|
||||||
This is the XML Schema for the persistence configuration file.
|
This is the XML Schema for the persistence configuration file.
|
||||||
The file must be named "META-INF/persistence.xml" in the
|
The file must be named "META-INF/persistence.xml" in the
|
||||||
persistence archive.
|
persistence archive.
|
||||||
Persistence configuration files must indicate
|
Persistence configuration files must indicate
|
||||||
the persistence schema by using the persistence namespace:
|
the persistence schema by using the persistence namespace:
|
||||||
|
|
||||||
http://java.sun.com/xml/ns/persistence
|
http://java.sun.com/xml/ns/persistence
|
||||||
|
|
||||||
and indicate the version of the schema by
|
and indicate the version of the schema by
|
||||||
using the version element as shown below:
|
using the version element as shown below:
|
||||||
|
|
||||||
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
|
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
|
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
|
||||||
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
|
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
|
||||||
version="1.0">
|
version="1.0">
|
||||||
...
|
...
|
||||||
</persistence>
|
</persistence>
|
||||||
|
|
||||||
]]></xsd:documentation>
|
]]></xsd:documentation>
|
||||||
</xsd:annotation>
|
</xsd:annotation>
|
||||||
|
|
||||||
<xsd:simpleType name="versionType">
|
<xsd:simpleType name="versionType">
|
||||||
<xsd:restriction base="xsd:token">
|
<xsd:restriction base="xsd:token">
|
||||||
<xsd:pattern value="[0-9]+(\.[0-9]+)*"/>
|
<xsd:pattern value="[0-9]+(\.[0-9]+)*"/>
|
||||||
</xsd:restriction>
|
</xsd:restriction>
|
||||||
</xsd:simpleType>
|
</xsd:simpleType>
|
||||||
|
|
||||||
<!-- **************************************************** -->
|
<!-- **************************************************** -->
|
||||||
|
|
||||||
<xsd:element name="persistence">
|
<xsd:element name="persistence">
|
||||||
<xsd:complexType>
|
<xsd:complexType>
|
||||||
<xsd:sequence>
|
<xsd:sequence>
|
||||||
|
|
||||||
<!-- **************************************************** -->
|
<!-- **************************************************** -->
|
||||||
|
|
||||||
<xsd:element name="persistence-unit"
|
<xsd:element name="persistence-unit"
|
||||||
minOccurs="0" maxOccurs="unbounded">
|
minOccurs="0" maxOccurs="unbounded">
|
||||||
<xsd:complexType>
|
<xsd:complexType>
|
||||||
<xsd:annotation>
|
<xsd:annotation>
|
||||||
<xsd:documentation>
|
<xsd:documentation>
|
||||||
|
|
||||||
Configuration of a persistence unit.
|
Configuration of a persistence unit.
|
||||||
|
|
||||||
</xsd:documentation>
|
</xsd:documentation>
|
||||||
</xsd:annotation>
|
</xsd:annotation>
|
||||||
<xsd:sequence>
|
<xsd:sequence>
|
||||||
|
|
||||||
<!-- **************************************************** -->
|
<!-- **************************************************** -->
|
||||||
|
|
||||||
<xsd:element name="description" type="xsd:string"
|
<xsd:element name="description" type="xsd:string"
|
||||||
minOccurs="0">
|
minOccurs="0">
|
||||||
<xsd:annotation>
|
<xsd:annotation>
|
||||||
<xsd:documentation>
|
<xsd:documentation>
|
||||||
|
|
||||||
Textual description of this persistence unit.
|
Textual description of this persistence unit.
|
||||||
|
|
||||||
</xsd:documentation>
|
</xsd:documentation>
|
||||||
</xsd:annotation>
|
</xsd:annotation>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
|
|
||||||
<!-- **************************************************** -->
|
<!-- **************************************************** -->
|
||||||
|
|
||||||
<xsd:element name="provider" type="xsd:string"
|
<xsd:element name="provider" type="xsd:string"
|
||||||
minOccurs="0">
|
minOccurs="0">
|
||||||
<xsd:annotation>
|
<xsd:annotation>
|
||||||
<xsd:documentation>
|
<xsd:documentation>
|
||||||
|
|
||||||
Provider class that supplies EntityManagers for this
|
Provider class that supplies EntityManagers for this
|
||||||
persistence unit.
|
persistence unit.
|
||||||
|
|
||||||
</xsd:documentation>
|
</xsd:documentation>
|
||||||
</xsd:annotation>
|
</xsd:annotation>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
|
|
||||||
<!-- **************************************************** -->
|
<!-- **************************************************** -->
|
||||||
|
|
||||||
<xsd:element name="jta-data-source" type="xsd:string"
|
<xsd:element name="jta-data-source" type="xsd:string"
|
||||||
minOccurs="0">
|
minOccurs="0">
|
||||||
<xsd:annotation>
|
<xsd:annotation>
|
||||||
<xsd:documentation>
|
<xsd:documentation>
|
||||||
|
|
||||||
The container-specific name of the JTA datasource to use.
|
The container-specific name of the JTA datasource to use.
|
||||||
|
|
||||||
</xsd:documentation>
|
</xsd:documentation>
|
||||||
</xsd:annotation>
|
</xsd:annotation>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
|
|
||||||
<!-- **************************************************** -->
|
<!-- **************************************************** -->
|
||||||
|
|
||||||
<xsd:element name="non-jta-data-source" type="xsd:string"
|
<xsd:element name="non-jta-data-source" type="xsd:string"
|
||||||
minOccurs="0">
|
minOccurs="0">
|
||||||
<xsd:annotation>
|
<xsd:annotation>
|
||||||
<xsd:documentation>
|
<xsd:documentation>
|
||||||
|
|
||||||
The container-specific name of a non-JTA datasource to use.
|
The container-specific name of a non-JTA datasource to use.
|
||||||
|
|
||||||
</xsd:documentation>
|
</xsd:documentation>
|
||||||
</xsd:annotation>
|
</xsd:annotation>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
|
|
||||||
<!-- **************************************************** -->
|
<!-- **************************************************** -->
|
||||||
|
|
||||||
<xsd:element name="mapping-file" type="xsd:string"
|
<xsd:element name="mapping-file" type="xsd:string"
|
||||||
minOccurs="0" maxOccurs="unbounded">
|
minOccurs="0" maxOccurs="unbounded">
|
||||||
<xsd:annotation>
|
<xsd:annotation>
|
||||||
<xsd:documentation>
|
<xsd:documentation>
|
||||||
|
|
||||||
File containing mapping information. Loaded as a resource
|
File containing mapping information. Loaded as a resource
|
||||||
by the persistence provider.
|
by the persistence provider.
|
||||||
|
|
||||||
</xsd:documentation>
|
</xsd:documentation>
|
||||||
</xsd:annotation>
|
</xsd:annotation>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
|
|
||||||
<!-- **************************************************** -->
|
<!-- **************************************************** -->
|
||||||
|
|
||||||
<xsd:element name="jar-file" type="xsd:string"
|
<xsd:element name="jar-file" type="xsd:string"
|
||||||
minOccurs="0" maxOccurs="unbounded">
|
minOccurs="0" maxOccurs="unbounded">
|
||||||
<xsd:annotation>
|
<xsd:annotation>
|
||||||
<xsd:documentation>
|
<xsd:documentation>
|
||||||
|
|
||||||
Jar file that should be scanned for entities.
|
Jar file that should be scanned for entities.
|
||||||
Not applicable to Java SE persistence units.
|
Not applicable to Java SE persistence units.
|
||||||
|
|
||||||
</xsd:documentation>
|
</xsd:documentation>
|
||||||
</xsd:annotation>
|
</xsd:annotation>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
|
|
||||||
<!-- **************************************************** -->
|
<!-- **************************************************** -->
|
||||||
|
|
||||||
<xsd:element name="class" type="xsd:string"
|
<xsd:element name="class" type="xsd:string"
|
||||||
minOccurs="0" maxOccurs="unbounded">
|
minOccurs="0" maxOccurs="unbounded">
|
||||||
<xsd:annotation>
|
<xsd:annotation>
|
||||||
<xsd:documentation>
|
<xsd:documentation>
|
||||||
|
|
||||||
Class to scan for annotations. It should be annotated
|
Class to scan for annotations. It should be annotated
|
||||||
with either @Entity, @Embeddable or @MappedSuperclass.
|
with either @Entity, @Embeddable or @MappedSuperclass.
|
||||||
|
|
||||||
</xsd:documentation>
|
</xsd:documentation>
|
||||||
</xsd:annotation>
|
</xsd:annotation>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
|
|
||||||
<!-- **************************************************** -->
|
<!-- **************************************************** -->
|
||||||
|
|
||||||
<xsd:element name="exclude-unlisted-classes" type="xsd:boolean"
|
<xsd:element name="exclude-unlisted-classes" type="xsd:boolean"
|
||||||
default="false" minOccurs="0">
|
default="false" minOccurs="0">
|
||||||
<xsd:annotation>
|
<xsd:annotation>
|
||||||
<xsd:documentation>
|
<xsd:documentation>
|
||||||
|
|
||||||
When set to true then only listed classes and jars will
|
When set to true then only listed classes and jars will
|
||||||
be scanned for persistent classes, otherwise the enclosing
|
be scanned for persistent classes, otherwise the enclosing
|
||||||
jar or directory will also be scanned. Not applicable to
|
jar or directory will also be scanned. Not applicable to
|
||||||
Java SE persistence units.
|
Java SE persistence units.
|
||||||
|
|
||||||
</xsd:documentation>
|
</xsd:documentation>
|
||||||
</xsd:annotation>
|
</xsd:annotation>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
|
|
||||||
<!-- **************************************************** -->
|
<!-- **************************************************** -->
|
||||||
|
|
||||||
<xsd:element name="properties" minOccurs="0">
|
<xsd:element name="properties" minOccurs="0">
|
||||||
<xsd:annotation>
|
<xsd:annotation>
|
||||||
<xsd:documentation>
|
<xsd:documentation>
|
||||||
|
|
||||||
A list of vendor-specific properties.
|
A list of vendor-specific properties.
|
||||||
|
|
||||||
</xsd:documentation>
|
</xsd:documentation>
|
||||||
</xsd:annotation>
|
</xsd:annotation>
|
||||||
<xsd:complexType>
|
<xsd:complexType>
|
||||||
<xsd:sequence>
|
<xsd:sequence>
|
||||||
<xsd:element name="property"
|
<xsd:element name="property"
|
||||||
minOccurs="0" maxOccurs="unbounded">
|
minOccurs="0" maxOccurs="unbounded">
|
||||||
<xsd:annotation>
|
<xsd:annotation>
|
||||||
<xsd:documentation>
|
<xsd:documentation>
|
||||||
A name-value pair.
|
A name-value pair.
|
||||||
</xsd:documentation>
|
</xsd:documentation>
|
||||||
</xsd:annotation>
|
</xsd:annotation>
|
||||||
<xsd:complexType>
|
<xsd:complexType>
|
||||||
<xsd:attribute name="name" type="xsd:string"
|
<xsd:attribute name="name" type="xsd:string"
|
||||||
use="required"/>
|
use="required"/>
|
||||||
<xsd:attribute name="value" type="xsd:string"
|
<xsd:attribute name="value" type="xsd:string"
|
||||||
use="required"/>
|
use="required"/>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
|
|
||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
|
|
||||||
<!-- **************************************************** -->
|
<!-- **************************************************** -->
|
||||||
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required">
|
<xsd:attribute name="name" type="xsd:string" use="required">
|
||||||
<xsd:annotation>
|
<xsd:annotation>
|
||||||
<xsd:documentation>
|
<xsd:documentation>
|
||||||
|
|
||||||
Name used in code to reference this persistence unit.
|
Name used in code to reference this persistence unit.
|
||||||
|
|
||||||
</xsd:documentation>
|
</xsd:documentation>
|
||||||
</xsd:annotation>
|
</xsd:annotation>
|
||||||
</xsd:attribute>
|
</xsd:attribute>
|
||||||
|
|
||||||
<!-- **************************************************** -->
|
<!-- **************************************************** -->
|
||||||
|
|
||||||
<xsd:attribute name="transaction-type"
|
<xsd:attribute name="transaction-type"
|
||||||
type="persistence:persistence-unit-transaction-type">
|
type="persistence:persistence-unit-transaction-type">
|
||||||
<xsd:annotation>
|
<xsd:annotation>
|
||||||
<xsd:documentation>
|
<xsd:documentation>
|
||||||
|
|
||||||
Type of transactions used by EntityManagers from this
|
Type of transactions used by EntityManagers from this
|
||||||
persistence unit.
|
persistence unit.
|
||||||
|
|
||||||
</xsd:documentation>
|
</xsd:documentation>
|
||||||
</xsd:annotation>
|
</xsd:annotation>
|
||||||
</xsd:attribute>
|
</xsd:attribute>
|
||||||
|
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
</xsd:sequence>
|
</xsd:sequence>
|
||||||
<xsd:attribute name="version" type="persistence:versionType"
|
<xsd:attribute name="version" type="persistence:versionType"
|
||||||
fixed="1.0" use="required"/>
|
fixed="1.0" use="required"/>
|
||||||
</xsd:complexType>
|
</xsd:complexType>
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
|
|
||||||
<!-- **************************************************** -->
|
<!-- **************************************************** -->
|
||||||
|
|
||||||
<xsd:simpleType name="persistence-unit-transaction-type">
|
<xsd:simpleType name="persistence-unit-transaction-type">
|
||||||
<xsd:annotation>
|
<xsd:annotation>
|
||||||
<xsd:documentation>
|
<xsd:documentation>
|
||||||
|
|
||||||
public enum TransactionType { JTA, RESOURCE_LOCAL };
|
public enum TransactionType { JTA, RESOURCE_LOCAL };
|
||||||
|
|
||||||
</xsd:documentation>
|
</xsd:documentation>
|
||||||
</xsd:annotation>
|
</xsd:annotation>
|
||||||
<xsd:restriction base="xsd:token">
|
<xsd:restriction base="xsd:token">
|
||||||
<xsd:enumeration value="JTA"/>
|
<xsd:enumeration value="JTA"/>
|
||||||
<xsd:enumeration value="RESOURCE_LOCAL"/>
|
<xsd:enumeration value="RESOURCE_LOCAL"/>
|
||||||
</xsd:restriction>
|
</xsd:restriction>
|
||||||
</xsd:simpleType>
|
</xsd:simpleType>
|
||||||
|
|
||||||
</xsd:schema>
|
</xsd:schema>
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class NewBootProcessTest {
|
||||||
@Override
|
@Override
|
||||||
public URL getPersistenceUnitRootUrl() {
|
public URL getPersistenceUnitRootUrl() {
|
||||||
// just get any known url...
|
// just get any known url...
|
||||||
return HibernatePersistenceProvider.class.getResource( "/org/hibernate/ejb/persistence_1_0.xsd" );
|
return HibernatePersistenceProvider.class.getResource( "/org/hibernate/jpa/persistence_1_0.xsd" );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
settings
|
settings
|
||||||
|
|
Loading…
Reference in New Issue