Rename core classes (remove *Adapter)

This commit is contained in:
Konstantin Krivopustov 2008-12-18 14:11:06 +00:00
parent 1722fd029c
commit c224cacdde
21 changed files with 108 additions and 111 deletions

View File

@ -11,7 +11,7 @@ package com.haulmont.cuba.core;
import com.haulmont.cuba.core.entity.BaseEntity;
public interface EntityManagerAdapter
public interface EntityManager
{
void persist(BaseEntity entity);
@ -21,7 +21,7 @@ public interface EntityManagerAdapter
<T extends BaseEntity> T find(Class<T> clazz, Object key);
QueryAdapter createQuery(String qlStr);
Query createQuery(String qlStr);
void flush();

View File

@ -9,11 +9,11 @@
*/
package com.haulmont.cuba.core;
import com.haulmont.cuba.core.impl.EntityManagerAdapterImpl;
import com.haulmont.cuba.core.impl.EntityManagerImpl;
import java.io.Serializable;
public interface EntityManagerFactoryAdapter extends Serializable
public interface EntityManagerFactory extends Serializable
{
EntityManagerAdapterImpl createEntityManager();
EntityManagerImpl createEntityManager();
}

View File

@ -40,7 +40,7 @@ public abstract class Locator
return (T) getInstance().__lookupMBean(mbeanClass, name);
}
public static TransactionAdapter createTransaction() {
public static Transaction createTransaction() {
return getInstance().__createTransaction();
}
@ -52,5 +52,5 @@ public abstract class Locator
protected abstract <T> T __lookupMBean(Class<T> mbeanClass, String name);
protected abstract TransactionAdapter __createTransaction();
protected abstract Transaction __createTransaction();
}

View File

@ -18,10 +18,8 @@ import java.util.BitSet;
import java.util.List;
import java.util.ArrayList;
import org.jboss.remoting.samples.chat.exceptions.InvalidArgumentException;
import org.apache.commons.lang.StringUtils;
import org.apache.openjpa.enhance.PersistenceCapable;
import org.apache.openjpa.enhance.StateManager;
import org.apache.openjpa.kernel.OpenJPAStateManager;
import org.apache.openjpa.meta.FieldMetaData;
@ -58,11 +56,11 @@ public abstract class PersistenceProvider
return unitName;
}
public static EntityManagerFactoryAdapter getEntityManagerFactory() {
public static EntityManagerFactory getEntityManagerFactory() {
return getInstance().__getEntityManagerFactory();
}
public static EntityManagerAdapter getEntityManager() {
public static EntityManager getEntityManager() {
return getInstance().__getEntityManager();
}
@ -93,7 +91,7 @@ public abstract class PersistenceProvider
return list.toArray(new String[list.size()]);
}
protected abstract EntityManagerFactoryAdapter __getEntityManagerFactory();
protected abstract EntityManagerFactory __getEntityManagerFactory();
protected abstract EntityManagerAdapter __getEntityManager();
protected abstract EntityManager __getEntityManager();
}

View File

@ -14,7 +14,7 @@ import javax.persistence.TemporalType;
import java.util.List;
import java.util.Date;
public interface QueryAdapter
public interface Query
{
List getResultList();
@ -22,15 +22,15 @@ public interface QueryAdapter
int executeUpdate();
QueryAdapter setMaxResults(int maxResult);
Query setMaxResults(int maxResult);
QueryAdapter setFirstResult(int startPosition);
Query setFirstResult(int startPosition);
QueryAdapter setParameter(String name, Object value);
Query setParameter(String name, Object value);
QueryAdapter setParameter(String name, Date value, TemporalType temporalType);
Query setParameter(String name, Date value, TemporalType temporalType);
QueryAdapter setParameter(int position, Object value);
Query setParameter(int position, Object value);
QueryAdapter setParameter(int position, Date value, TemporalType temporalType);
Query setParameter(int position, Date value, TemporalType temporalType);
}

View File

@ -10,7 +10,7 @@
*/
package com.haulmont.cuba.core;
public interface TransactionAdapter
public interface Transaction
{
void commit();

View File

@ -12,19 +12,19 @@ package com.haulmont.cuba.core.impl;
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactory;
import org.apache.openjpa.persistence.OpenJPAEntityManager;
import com.haulmont.cuba.core.impl.EntityManagerAdapterImpl;
import com.haulmont.cuba.core.EntityManagerFactoryAdapter;
import com.haulmont.cuba.core.impl.EntityManagerImpl;
import com.haulmont.cuba.core.EntityManagerFactory;
public class EntityManagerFactoryAdapterImpl implements EntityManagerFactoryAdapter
public class EntityManagerFactoryImpl implements EntityManagerFactory
{
private OpenJPAEntityManagerFactory jpaFactory;
EntityManagerFactoryAdapterImpl(OpenJPAEntityManagerFactory jpaFactory) {
EntityManagerFactoryImpl(OpenJPAEntityManagerFactory jpaFactory) {
this.jpaFactory = jpaFactory;
}
public EntityManagerAdapterImpl createEntityManager() {
public EntityManagerImpl createEntityManager() {
OpenJPAEntityManager em = jpaFactory.createEntityManager();
return new EntityManagerAdapterImpl(em);
return new EntityManagerImpl(em);
}
}

View File

@ -12,20 +12,20 @@ package com.haulmont.cuba.core.impl;
import org.apache.openjpa.persistence.OpenJPAEntityManager;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.haulmont.cuba.core.EntityManagerAdapter;
import com.haulmont.cuba.core.EntityManager;
import com.haulmont.cuba.core.SecurityProvider;
import com.haulmont.cuba.core.QueryAdapter;
import com.haulmont.cuba.core.Query;
import com.haulmont.cuba.core.global.TimeProvider;
import com.haulmont.cuba.core.entity.BaseEntity;
import com.haulmont.cuba.core.entity.DeleteDeferred;
public class EntityManagerAdapterImpl implements EntityManagerAdapter
public class EntityManagerImpl implements EntityManager
{
private Log log = LogFactory.getLog(EntityManagerAdapterImpl.class);
private Log log = LogFactory.getLog(EntityManagerImpl.class);
private OpenJPAEntityManager jpaEm;
EntityManagerAdapterImpl(OpenJPAEntityManager jpaEntityManager) {
EntityManagerImpl(OpenJPAEntityManager jpaEntityManager) {
this.jpaEm = jpaEntityManager;
}
@ -51,9 +51,9 @@ public class EntityManagerAdapterImpl implements EntityManagerAdapter
return jpaEm.find(clazz, key);
}
public QueryAdapter createQuery(String qlStr) {
public Query createQuery(String qlStr) {
log.debug("Creating JPQL query: " + qlStr);
return new QueryAdapterImpl(jpaEm.createQuery(qlStr));
return new QueryImpl(jpaEm.createQuery(qlStr));
}
public void flush() {

View File

@ -10,17 +10,20 @@
*/
package com.haulmont.cuba.core.impl;
import com.haulmont.cuba.core.TransactionAdapter;
import com.haulmont.cuba.core.Transaction;
import javax.transaction.*;
import javax.transaction.TransactionManager;
import javax.transaction.SystemException;
import javax.transaction.NotSupportedException;
import javax.transaction.Status;
public class JtaTransactionAdapter implements TransactionAdapter
public class JtaTransaction implements Transaction
{
private TransactionManager tm;
private boolean committed;
public JtaTransactionAdapter(TransactionManager tm) {
public JtaTransaction(TransactionManager tm) {
this.tm = tm;
try {
if (tm.getTransaction() == null) {

View File

@ -10,8 +10,7 @@
package com.haulmont.cuba.core.impl;
import com.haulmont.cuba.core.Locator;
import com.haulmont.cuba.core.PersistenceProvider;
import com.haulmont.cuba.core.TransactionAdapter;
import com.haulmont.cuba.core.Transaction;
import javax.naming.Context;
import javax.naming.InitialContext;
@ -70,7 +69,7 @@ public class LocatorImpl extends Locator
}
}
protected TransactionAdapter __createTransaction() {
protected Transaction __createTransaction() {
Context ctx = __getJndiContextImpl();
TransactionManager tm;
try {
@ -78,7 +77,7 @@ public class LocatorImpl extends Locator
} catch (NamingException e) {
throw new RuntimeException(e);
}
return new JtaTransactionAdapter(tm);
return new JtaTransaction(tm);
}
}

View File

@ -11,7 +11,6 @@ package com.haulmont.cuba.core.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.lang.StringUtils;
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactory;
import org.apache.openjpa.persistence.OpenJPAPersistence;
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
@ -22,11 +21,11 @@ import javax.transaction.*;
import java.util.Hashtable;
import java.util.Map;
import com.haulmont.cuba.core.impl.EntityManagerAdapterImpl;
import com.haulmont.cuba.core.impl.EntityManagerFactoryAdapterImpl;
import com.haulmont.cuba.core.impl.EntityManagerImpl;
import com.haulmont.cuba.core.impl.EntityManagerFactoryImpl;
import com.haulmont.cuba.core.PersistenceProvider;
import com.haulmont.cuba.core.EntityManagerFactoryAdapter;
import com.haulmont.cuba.core.EntityManagerAdapter;
import com.haulmont.cuba.core.EntityManagerFactory;
import com.haulmont.cuba.core.EntityManager;
import com.haulmont.cuba.core.impl.persistence.EntityLifecycleListener;
public class ManagedPersistenceProvider extends PersistenceProvider
@ -37,7 +36,7 @@ public class ManagedPersistenceProvider extends PersistenceProvider
private boolean emfInitialized;
private Map<Transaction, EntityManagerAdapterImpl> emMap = new Hashtable<Transaction, EntityManagerAdapterImpl>();
private Map<Transaction, EntityManagerImpl> emMap = new Hashtable<Transaction, EntityManagerImpl>();
public static final String EMF_JNDI_NAME = "EntityManagerFactoryAdapterImpl";
@ -49,7 +48,7 @@ public class ManagedPersistenceProvider extends PersistenceProvider
this.jndiContext = jndiContext;
}
protected EntityManagerFactoryAdapter __getEntityManagerFactory() {
protected EntityManagerFactory __getEntityManagerFactory() {
synchronized (mutex) {
if (!emfInitialized) {
log.debug("Creating new EntityManagerFactory");
@ -62,7 +61,7 @@ public class ManagedPersistenceProvider extends PersistenceProvider
OpenJPAPersistence.createEntityManagerFactory(unitName, xmlPath);
initJpaFactory(jpaFactory);
EntityManagerFactoryAdapter emf = new EntityManagerFactoryAdapterImpl(jpaFactory);
EntityManagerFactory emf = new EntityManagerFactoryImpl(jpaFactory);
try {
log.debug("Binding new EntityManagerFactory to JNDI context " + EMF_JNDI_NAME);
jndiContext.bind(EMF_JNDI_NAME, emf);
@ -73,7 +72,7 @@ public class ManagedPersistenceProvider extends PersistenceProvider
}
}
try {
return (EntityManagerFactoryAdapter) jndiContext.lookup(EMF_JNDI_NAME);
return (EntityManagerFactory) jndiContext.lookup(EMF_JNDI_NAME);
} catch (NamingException e) {
throw new RuntimeException(e);
}
@ -86,8 +85,8 @@ public class ManagedPersistenceProvider extends PersistenceProvider
);
}
protected EntityManagerAdapter __getEntityManager() {
EntityManagerAdapterImpl em;
protected EntityManager __getEntityManager() {
EntityManagerImpl em;
try {
TransactionManager tm = getTransactionManager();
Transaction tx = tm.getTransaction();
@ -112,7 +111,7 @@ public class ManagedPersistenceProvider extends PersistenceProvider
}
}
private void registerSync(final javax.transaction.Transaction tx, final EntityManagerAdapter em) {
private void registerSync(final javax.transaction.Transaction tx, final EntityManager em) {
try {
tx.registerSynchronization(
new Synchronization()

View File

@ -10,7 +10,7 @@
*/
package com.haulmont.cuba.core.impl;
import com.haulmont.cuba.core.QueryAdapter;
import com.haulmont.cuba.core.Query;
import javax.persistence.TemporalType;
import javax.persistence.FlushModeType;
@ -19,11 +19,11 @@ import java.util.Date;
import org.apache.openjpa.persistence.OpenJPAQuery;
public class QueryAdapterImpl implements QueryAdapter
public class QueryImpl implements Query
{
private OpenJPAQuery query;
public QueryAdapterImpl(OpenJPAQuery query) {
public QueryImpl(OpenJPAQuery query) {
this.query = query;
this.query.setFlushMode(FlushModeType.COMMIT);
}
@ -40,32 +40,32 @@ public class QueryAdapterImpl implements QueryAdapter
return query.executeUpdate();
}
public QueryAdapter setMaxResults(int maxResult) {
public Query setMaxResults(int maxResult) {
query.setMaxResults(maxResult);
return this;
}
public QueryAdapter setFirstResult(int startPosition) {
public Query setFirstResult(int startPosition) {
query.setFirstResult(startPosition);
return this;
}
public QueryAdapter setParameter(String name, Object value) {
public Query setParameter(String name, Object value) {
query.setParameter(name, value);
return this;
}
public QueryAdapter setParameter(String name, Date value, TemporalType temporalType) {
public Query setParameter(String name, Date value, TemporalType temporalType) {
query.setParameter(name, value, temporalType);
return this;
}
public QueryAdapter setParameter(int position, Object value) {
public Query setParameter(int position, Object value) {
query.setParameter(position, value);
return this;
}
public QueryAdapter setParameter(int position, Date value, TemporalType temporalType) {
public Query setParameter(int position, Date value, TemporalType temporalType) {
query.setParameter(position, value, temporalType);
return this;
}

View File

@ -12,9 +12,9 @@ package com.haulmont.cuba.core.worker;
import com.haulmont.cuba.core.entity.BaseEntity;
import com.haulmont.cuba.core.global.BasicInvocationContext;
import com.haulmont.cuba.core.EntityManagerAdapter;
import com.haulmont.cuba.core.EntityManager;
import com.haulmont.cuba.core.PersistenceProvider;
import com.haulmont.cuba.core.QueryAdapter;
import com.haulmont.cuba.core.Query;
import javax.ejb.Stateless;
import java.util.List;
@ -23,43 +23,43 @@ import java.util.List;
public class BasicWorkerBean implements BasicWorker
{
public <T extends BaseEntity> T create(T entity) {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
em.persist(entity);
return entity;
}
public <T extends BaseEntity> T update(T entity) {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
T result = em.merge(entity);
return result;
}
public void delete(BasicInvocationContext ctx) {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
BaseEntity entity = em.find(ctx.getEntityClass(), ctx.getId());
em.remove(entity);
}
public <T extends BaseEntity> T get(BasicInvocationContext ctx) {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
BaseEntity result = em.find(ctx.getEntityClass(), ctx.getId());
return (T) result;
}
public <T extends BaseEntity> T load(BasicInvocationContext ctx) {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
String queryString =
"select e from " +
PersistenceProvider.getEntityName(ctx.getEntityClass()) + " e where e.id = ?1";
QueryAdapter query = em.createQuery(queryString);
Query query = em.createQuery(queryString);
query.setParameter(1, ctx.getId());
Object result = query.getSingleResult();
return (T) result;
}
public <T extends BaseEntity> List<T> loadList(BasicInvocationContext ctx) {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
QueryAdapter query = em.createQuery(ctx.getQueryString());
EntityManager em = PersistenceProvider.getEntityManager();
Query query = em.createQuery(ctx.getQueryString());
List resultList = query.getResultList();
return resultList;
}

View File

@ -10,7 +10,7 @@
*/
package com.haulmont.cuba.security.listener;
import com.haulmont.cuba.core.EntityManagerAdapter;
import com.haulmont.cuba.core.EntityManager;
import com.haulmont.cuba.core.PersistenceProvider;
import com.haulmont.cuba.core.listener.BeforeDeleteEntityListener;
import com.haulmont.cuba.security.entity.Profile;
@ -19,7 +19,7 @@ import com.haulmont.cuba.security.entity.ProfileRole;
public class ProfileEntityListener implements BeforeDeleteEntityListener<Profile>
{
public void onBeforeDelete(Profile profile) {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
for (ProfileRole profileRole : profile.getProfileRoles()) {
em.remove(profileRole);

View File

@ -10,9 +10,9 @@
*/
package com.haulmont.cuba.security.listener;
import com.haulmont.cuba.core.EntityManagerAdapter;
import com.haulmont.cuba.core.EntityManager;
import com.haulmont.cuba.core.PersistenceProvider;
import com.haulmont.cuba.core.QueryAdapter;
import com.haulmont.cuba.core.Query;
import com.haulmont.cuba.core.listener.BeforeDeleteEntityListener;
import com.haulmont.cuba.security.entity.ProfileRole;
import com.haulmont.cuba.security.entity.Role;
@ -22,9 +22,9 @@ import java.util.List;
public class RoleEntityListener implements BeforeDeleteEntityListener<Role>
{
public void onBeforeDelete(Role entity) {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
QueryAdapter query = em.createQuery("select pr from sec$ProfileRole pr where pr.role = ?1");
Query query = em.createQuery("select pr from sec$ProfileRole pr where pr.role = ?1");
query.setParameter(1, entity);
List<ProfileRole> list = query.getResultList();
for (ProfileRole profileRole : list) {

View File

@ -18,8 +18,8 @@ import com.haulmont.cuba.security.entity.User;
import com.haulmont.cuba.security.resource.Messages;
import com.haulmont.cuba.security.impl.UserSessionManager;
import com.haulmont.cuba.core.PersistenceProvider;
import com.haulmont.cuba.core.EntityManagerAdapter;
import com.haulmont.cuba.core.QueryAdapter;
import com.haulmont.cuba.core.EntityManager;
import com.haulmont.cuba.core.Query;
import com.haulmont.cuba.core.SecurityProvider;
import javax.ejb.Stateless;
@ -38,8 +38,8 @@ public class LoginWorkerBean implements LoginWorker
private User loadUser(String login, String password, Locale locale)
throws LoginException
{
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
QueryAdapter q = em.createQuery(
EntityManager em = PersistenceProvider.getEntityManager();
Query q = em.createQuery(
"select u " +
" from sec$User u join fetch u.profiles" +
" where u.login = ?1 and u.password = ?2 and u.deleteTs is null");

View File

@ -18,9 +18,9 @@ public class EntityListenerTest extends CubaTestCase
{
public void test() {
UUID id;
TransactionAdapter tx = Locator.createTransaction();
Transaction tx = Locator.createTransaction();
try {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
assertNotNull(em);
Server server = new Server();
id = server.getId();

View File

@ -10,7 +10,6 @@
package com.haulmont.cuba.core;
import com.haulmont.cuba.core.entity.Server;
import com.haulmont.cuba.core.global.UuidProvider;
import javax.transaction.*;
import javax.naming.Context;
@ -23,7 +22,7 @@ public class PersistenceTest extends CubaTestCase
UUID id;
beginTran();
try {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
assertNotNull(em);
Server server = new Server();
id = server.getId();
@ -39,7 +38,7 @@ public class PersistenceTest extends CubaTestCase
beginTran();
try {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
Server server = em.find(Server.class, id);
assertEquals(id, server.getId());
@ -52,7 +51,7 @@ public class PersistenceTest extends CubaTestCase
beginTran();
try {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
Server server = em.find(Server.class, id);
assertEquals(id, server.getId());

View File

@ -20,9 +20,9 @@ public class TransactionTest extends CubaTestCase
public void testCommit() {
UUID id;
TransactionAdapter tx = Locator.createTransaction();
Transaction tx = Locator.createTransaction();
try {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
assertNotNull(em);
Server server = new Server();
id = server.getId();
@ -38,7 +38,7 @@ public class TransactionTest extends CubaTestCase
tx = Locator.createTransaction();
try {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
Server server = em.find(Server.class, id);
assertEquals(id, server.getId());
server.setAddress("222");
@ -51,9 +51,9 @@ public class TransactionTest extends CubaTestCase
public void testCommitRetaining() {
UUID id;
TransactionAdapter tx = Locator.createTransaction();
Transaction tx = Locator.createTransaction();
try {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
assertNotNull(em);
Server server = new Server();
id = server.getId();
@ -85,9 +85,9 @@ public class TransactionTest extends CubaTestCase
}
private void __testRollback() {
TransactionAdapter tx = Locator.createTransaction();
Transaction tx = Locator.createTransaction();
try {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
assertNotNull(em);
Server server = new Server();
server.setName("localhost");
@ -111,9 +111,9 @@ public class TransactionTest extends CubaTestCase
}
private void __testRollbackAndCatch() {
TransactionAdapter tx = Locator.createTransaction();
Transaction tx = Locator.createTransaction();
try {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
assertNotNull(em);
Server server = new Server();
server.setName("localhost");
@ -141,9 +141,9 @@ public class TransactionTest extends CubaTestCase
private void __testCommitRetainingAndRollback() {
UUID id;
TransactionAdapter tx = Locator.createTransaction();
Transaction tx = Locator.createTransaction();
try {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
assertNotNull(em);
Server server = new Server();
id = server.getId();

View File

@ -23,9 +23,9 @@ public class RelationsTest extends CubaTestCase
public void testProfile() {
UUID profileId = createProfile();
TransactionAdapter tx = Locator.createTransaction();
Transaction tx = Locator.createTransaction();
try {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
Profile profile = em.find(Profile.class, profileId);
em.remove(profile);
@ -39,9 +39,9 @@ public class RelationsTest extends CubaTestCase
public void testRole() {
UUID roleId = createRole();
TransactionAdapter tx = Locator.createTransaction();
Transaction tx = Locator.createTransaction();
try {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
Role role = em.find(Role.class, roleId);
em.remove(role);
@ -53,9 +53,9 @@ public class RelationsTest extends CubaTestCase
}
public UUID createProfile() {
TransactionAdapter tx = Locator.createTransaction();
Transaction tx = Locator.createTransaction();
try {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
User user = em.find(User.class, UUID.fromString("60885987-1b61-4247-94c7-dff348347f93"));
Role role = em.find(Role.class, UUID.fromString("0c018061-b26f-4de2-a5be-dff348347f93"));
@ -79,9 +79,9 @@ public class RelationsTest extends CubaTestCase
}
public UUID createRole() {
TransactionAdapter tx = Locator.createTransaction();
Transaction tx = Locator.createTransaction();
try {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
Profile profile = em.find(Profile.class, UUID.fromString("bf83541f-f610-46f4-a268-dff348347f93"));

View File

@ -11,7 +11,6 @@
package com.haulmont.cuba.security;
import com.haulmont.cuba.core.*;
import com.haulmont.cuba.core.global.UuidProvider;
import com.haulmont.cuba.security.entity.User;
import com.haulmont.cuba.security.entity.Role;
import com.haulmont.cuba.security.entity.Profile;
@ -23,9 +22,9 @@ import java.util.Set;
public class UserRoleTest extends CubaTestCase
{
public void test() {
TransactionAdapter tx = Locator.createTransaction();
Transaction tx = Locator.createTransaction();
try {
EntityManagerAdapter em = PersistenceProvider.getEntityManager();
EntityManager em = PersistenceProvider.getEntityManager();
User user = new User();
UUID userId = user.getId();