Hi folks,
been trying to find out whats the problem for two days now, but still no progress..
I have the following issue:
I use a class with a String @Id (login) and want to index it with Lucene. However when em.persist(entity) is called I get a rollback exception.
So this is the code:
Account.class
Code:
@Entity
@Indexed(index="account")
public class Account implements Serializable {
private static final long serialVersionUID = 2783056607558816506L;
private String _login;
private String _password;
private String _firstName;
private String _lastName;
private String _registrationToken;
private List<Contact> _contact;
private AccountStatus _status;
private Locale _preferedLocale;
private Sex _sex;
private Date _birthDay;
private Set<Role> _roles;
private List<ProfileContentMeta> _profile_image_list;
public Account() {}
public Account(String p_login, String p_password, String p_firstName, String p_lastName, Sex p_sex, Date p_birthDay, Locale p_preferredLocale) {
super();
setLogin(p_login);
setPassword(p_password);
setFirstName(p_firstName);
setLastName(p_lastName);
setSex(p_sex);
setBirthDay(p_birthDay);
setAccountStatus(AccountStatus.RESERVATION);
setPreferredLocale(p_preferredLocale);
}
@VO @Id
public String getLogin() {return _login;}
public void setLogin(String p_login) {_login = p_login;}
...
The manager class:
Code:
public commons.vo.account.Account prepareAccountCreation(String p_login, String p_password, String p_firstName, String p_lastName, Sex p_sex, Date p_birthDay, String p_email, String p_street, String p_city, String p_country, String p_houseNumber, String p_PLZ, Locale p_preferredLocale) {
if (p_login == null)
return null;
else {
Account m_acc = _em.find(Account.class, p_login);
if (m_acc != null)
return (commons.vo.account.Account) VOBuilder.buildVO(m_acc);
else {
m_acc = new Account(p_login, encodeMd5Hex(p_password), p_firstName, p_lastName, p_sex, p_birthDay, p_preferredLocale);
Contact m_contact = new Contact(m_acc, p_email, p_street, p_city, p_country, p_houseNumber, p_PLZ);
m_acc.setRegistrationToken(TokenFactory.createToken(m_acc.getLogin()));
m_acc.setContact(m_contact);
m_acc.setAccountStatus(AccountStatus.RESERVATION);
_em.persist(m_acc);
log(Severity.FINE, "Account reserved: {0}.", m_acc.getLogin());
_maintenanceManager.scheduleAccountReservationMaintenance(m_acc);
return (commons.vo.account.Account) VOBuilder.buildVO(m_acc);
}
}
}
The exception:
Code:
[#|2010-06-22T23:53:55.583+0200|WARNING|glassfishv3.0|javax.enterprise.system.core.transaction.com.sun.jts.jta|_ThreadID=27;_ThreadName=Thread-1;|JTS5054: Unexpected error occurred in after completion
javax.persistence.PersistenceException: java.lang.UnsupportedOperationException
at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:1071)
at com.sun.jts.jta.SynchronizationImpl.before_completion(SynchronizationImpl.java:99)
at com.sun.jts.CosTransactions.RegisteredSyncs.distributeBefore(RegisteredSyncs.java:158)
at com.sun.jts.CosTransactions.TopCoordinator.beforeCompletion(TopCoordinator.java:2548)
at com.sun.jts.CosTransactions.CoordinatorTerm.commit(CoordinatorTerm.java:278)
at com.sun.jts.CosTransactions.TerminatorImpl.commit(TerminatorImpl.java:251)
at com.sun.jts.CosTransactions.CurrentImpl.commit(CurrentImpl.java:623)
at com.sun.jts.jta.TransactionManagerImpl.commit(TransactionManagerImpl.java:318)
at com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate.commitDistributedTransaction(JavaEETransactionManagerJTSDelegate.java:169)
at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.commit(JavaEETransactionManagerSimplified.java:843)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:4991)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4756)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1955)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1906)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:208)
at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:75)
at $Proxy262.prepareAccountCreation(Unknown Source)
...
Caused by: java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:131)
at java.util.AbstractList.add(AbstractList.java:91)
at org.hibernate.search.backend.WorkQueue.add(WorkQueue.java:59)
at org.hibernate.search.backend.impl.BatchedQueueingProcessor.add(BatchedQueueingProcessor.java:128)
at org.hibernate.search.backend.impl.PostTransactionWorkQueueSynchronization.add(PostTransactionWorkQueueSynchronization.java:62)
at org.hibernate.search.backend.impl.TransactionalWorker.performWork(TransactionalWorker.java:73)
at org.hibernate.search.event.FullTextIndexEventListener.processWork(FullTextIndexEventListener.java:178)
at org.hibernate.search.event.FullTextIndexEventListener.processCollectionEvent(FullTextIndexEventListener.java:225)
at org.hibernate.search.event.FullTextIndexEventListener.onPostRecreateCollection(FullTextIndexEventListener.java:195)
at org.hibernate.action.CollectionRecreateAction.postRecreate(CollectionRecreateAction.java:93)
at org.hibernate.action.CollectionRecreateAction.execute(CollectionRecreateAction.java:66)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:268)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:260)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:183)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:375)
at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:1057)
... 73 more
The following is what I found out:
1. It works on Hibernate Search release I had from last year but is not running on Hibernate Search 3.2
2. If I index/store a class with @Id as integer it works just fine
My classpath looks like this:
Uploaded with
ImageShack.usThanks a lot! Any ideas/discussions would be appriciated!