[
http://opensource.atlassian.com/projects/hibernate/browse/ANN-298?page=all ]
Emmanuel Bernard resolved ANN-298:
----------------------------------
Resolution: Incomplete
no further feedback
ClassCastExcepton: java.lang.Long at
org.hibernate.type.ComponentType.toLoggableString
--------------------------------------------------------------------------------------
Key: ANN-298
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-298
Project: Hibernate Annotations
Type: Bug
Environment: JBoss 4.0..3 EJB3-RC5
Hibernate 3.1.2
Reporter: Steven Verze
When loging is set the INFO I get the following exception:
javax.ejb.EJBException: java.lang.ClassCastException: java.lang.Long
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:192)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at
org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at
org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at
org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at
org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at
org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:219)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:107)
at
org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:580)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:450)
at
org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:290)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:344)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:202)
Caused by: java.lang.ClassCastException: java.lang.Long
at org.hibernate.type.ComponentType.toLoggableString(ComponentType.java:329)
at org.hibernate.pretty.MessageHelper.collectionInfoString(MessageHelper.java:187)
at org.hibernate.event.def.ReattachVisitor.removeCollection(ReattachVisitor.java:60)
at org.hibernate.event.def.OnUpdateVisitor.processCollection(OnUpdateVisitor.java:46)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:101)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:61)
at
org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:55)
at org.hibernate.event.def.AbstractVisitor.process(AbstractVisitor.java:123)
at
org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:72)
at org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:790)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:768)
at
org.hibernate.ejb.AbstractEntityManagerImpl.remove(AbstractEntityManagerImpl.java:155)
at org.jboss.ejb3.entity.InjectedEntityManager.remove(InjectedEntityManager.java:151)
at
com.teleglobal.modules.authentic.services.AuthenticAccountServiceBean.remove(AuthenticAccountServiceBean.java:99)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:109)
at
org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:192)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at
org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at
org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at
org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at
org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at
org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:219)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:107)
at
org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:580)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:450)
at
org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:290)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:344)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:202)
at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:163)
at org.jboss.remoting.Client.invoke(Client.java:258)
at org.jboss.remoting.Client.invoke(Client.java:221)
at
org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at
org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at
org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:55)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:65)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
at $Proxy1.remove(Unknown Source)
at
com.teleglobal.modules.authentic.servcies.AuthenticAccountServiceTest.tearDown(AuthenticAccountServiceTest.java:23)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
The problem goes away when I turn logging down to WARN.
I noticed that there was a similar bug (HHH-248) which was fixed in version 3.0.2
This exception really only occured when I used ManyToOne relationship using the
referencedColumnName attribute and only when I tried to remove AuthenticAccount .
My entities follow:
@Entity
@Table(name="ACCOUNT")
@SequenceGenerator(name="ACCOUNT_SEQUENCE",
sequenceName="ACCOUNT_SEQUENCE")
public class AuthenticAccount implements Serializable
{
@Id @GeneratedValue(strategy=GenerationType.SEQUENCE,
generator="ACCOUNT_SEQUENCE")
@Column(name="ACN_ID")
private long id;
@Column(name="ACN_ACCOUNT_NUMBER", unique=true)
private String accountNumber;
// Default values for all authentic test accounts
@Column(name="ACN_BALANCE_1")
private long balance1 = 5000;
@Column(name="ACN_STATUS")
private String status = "O";
@Column(name="ACN_PRO_ID")
private String proId = "11014";
@Column(name="ACN_CUR_ID")
private long curId = 826;
@Column(name="ACN_AMT_ID_1")
private long amountId1 = 2;
@Column(name="ACN_AMT_ID_2")
private long amountId2 = 1;
@Column(name="ACN_BALANCE_2")
private long balance2 = 0;
@Column(name="ACN_LAST_BATCH_UPDATE_DATE")
private Date lastBatchUpdateDate;
@Column(name="ACN_LAST_FEP_HOST_TRACE_NBR")
private long lastFepHostTraceNumber = 0;
@Column(name="ACN_LAST_HOST_FEP_TRACE_NBR")
private long lastHostFepTraceNumber = 118;
@Column(name="ACN_BILL_PAYMENT_FLG")
private int billPaymentFlag = 1;
@Column(name="ACN_TRANSFER_FLG")
private int transferFlag = 0;
@Column(name="ACN_FUNCTIONS")
private int functions = 1;
@Column(name="ACN_FEP_HOST_SUM")
private long fepHostSum = 110;
@Column(name="ACN_HOST_FEP_SUM")
private long hostFepSum = 811233;
@OneToOne(mappedBy="account", cascade=CascadeType.ALL, fetch=FetchType.EAGER)
private Card card;
@OneToMany(mappedBy="account", cascade=CascadeType.ALL,
fetch=FetchType.EAGER)
@JoinColumn(name="AMS_ACCOUNT_NUM",
referencedColumnName="ACN_ACCOUNT_NUMBER", nullable = false, unique = true)
private List<AuthenticAccountMiniStatement> miniStatements;
public AuthenticAccount()
{
lastBatchUpdateDate = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss a")
.parse("09/06/2005 12:00:00 AM", new ParsePosition(0));
card = new Card();
miniStatements = new ArrayList<AuthenticAccountMiniStatement>();
}
public String getAccountNumber()
{
return accountNumber;
}
public void setAccountNumber(String accountNumber)
{
this.accountNumber = accountNumber;
}
public long getAmountId1()
{
return amountId1;
}
public void setAmountId1(long amountId1)
{
this.amountId1 = amountId1;
}
public long getAmountId2()
{
return amountId2;
}
public void setAmountId2(long amountId2)
{
this.amountId2 = amountId2;
}
public long getBalance1()
{
return balance1;
}
public void setBalance1(long balance1)
{
this.balance1 = balance1;
}
public long getBalance2()
{
return balance2;
}
public void setBalance2(long balance2)
{
this.balance2 = balance2;
}
public int getBillPaymentFlag()
{
return billPaymentFlag;
}
public void setBillPaymentFlag(int billPaymentFlag)
{
this.billPaymentFlag = billPaymentFlag;
}
public long getCurId()
{
return curId;
}
public void setCurId(long curId)
{
this.curId = curId;
}
public long getFepHostSum()
{
return fepHostSum;
}
public void setFepHostSum(long fepHostSum)
{
this.fepHostSum = fepHostSum;
}
public int getFunctions()
{
return functions;
}
public void setFunctions(int functions)
{
this.functions = functions;
}
public long getHostFepSum()
{
return hostFepSum;
}
public void setHostFepSum(long hostFepSum)
{
this.hostFepSum = hostFepSum;
}
public long getId()
{
return id;
}
public void setId(long id)
{
this.id = id;
}
public Date getLastBatchUpdateDate()
{
return lastBatchUpdateDate;
}
public void setLastBatchUpdateDate(Date lastBatchUpdateDate)
{
this.lastBatchUpdateDate = lastBatchUpdateDate;
}
public long getLastFepHostTraceNumber()
{
return lastFepHostTraceNumber;
}
public void setLastFepHostTraceNumber(long lastFepHostTraceNumber)
{
this.lastFepHostTraceNumber = lastFepHostTraceNumber;
}
public long getLastHostFepTraceNumber()
{
return lastHostFepTraceNumber;
}
public void setLastHostFepTraceNumber(long lastHostFepTraceNumber)
{
this.lastHostFepTraceNumber = lastHostFepTraceNumber;
}
public String getProId()
{
return proId;
}
public void setProId(String proId)
{
this.proId = proId;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
public int getTransferFlag()
{
return transferFlag;
}
public void setTransferFlag(int transferFlag)
{
this.transferFlag = transferFlag;
}
public Card getCard()
{
return card;
}
public void setCard(Card card)
{
this.card = card;
}
public void addMiniStatement(AuthenticAccountMiniStatement miniStatement)
{
miniStatement.setAccount(this);
this.miniStatements.add(miniStatement);
}
public void removeMiniStatement(AuthenticAccountMiniStatement miniStatement)
{
this.miniStatements.remove(miniStatement);
}
public List<AuthenticAccountMiniStatement> getMiniStatements()
{
return miniStatements;
}
public void setMiniStatements(List<AuthenticAccountMiniStatement>
miniStatements)
{
this.miniStatements = miniStatements;
}
}
@Entity
@Table(name = "ACCOUNT_MINI_STATEMENT")
@SequenceGenerator(name="MINI_STATEMENT_SEQUENCE",
sequenceName="MINI_STATEMENT_SEQUENCE")
public class AuthenticAccountMiniStatement implements Serializable
{
@Id @GeneratedValue(strategy=GenerationType.SEQUENCE,
generator="MINI_STATEMENT_SEQUENCE")
@Column(name="AMS_TXN_SEQ")
private long id;
@Column(name="AMS_TXN_CODE")
private String transactionDescription = "LOAD";
@Column(name="AMS_TXN_DATE")
private Date transactionDate = new Date();
@Column(name="AMS_TXN_AMOUNT")
private long transactionAmount = 10;
@Column(name="AMS_TRL_BUSINESS_DATE")
private Date transactionLogBusinessDate = new Date();
@Column(name="AMS_TRL_ID")
private long transactionLogId = 34610;
@Column(name="AMS_GRP_SEQ")
private long groupSequence = 1;
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name="AMS_ACCOUNT_NUM",
referencedColumnName="ACN_ACCOUNT_NUMBER", nullable = false, unique = true)
private AuthenticAccount account;
public AuthenticAccountMiniStatement()
{
}
public long getTransactionAmount()
{
return transactionAmount;
}
public void setTransactionAmount(long transactionAmount)
{
this.transactionAmount = transactionAmount;
}
public Date getTransactionDate()
{
return transactionDate;
}
public void setTransactionDate(Date transactionDate)
{
this.transactionDate = transactionDate;
}
public String getTransactionDescription()
{
return transactionDescription;
}
public void setTransactionDescription(String transactionDescription)
{
this.transactionDescription = transactionDescription;
}
public long getGroupSequence()
{
return groupSequence;
}
public void setGroupSequence(long groupSequence)
{
this.groupSequence = groupSequence;
}
public long getId()
{
return id;
}
public void setId(long id)
{
this.id = id;
}
public Date getTransactionLogBusinessDate()
{
return transactionLogBusinessDate;
}
public void setTransactionLogBusinessDate(Date transactionLogBusinessDate)
{
this.transactionLogBusinessDate = transactionLogBusinessDate;
}
public long getTransactionLogId()
{
return transactionLogId;
}
public void setTransactionLogId(long transactionLogId)
{
this.transactionLogId = transactionLogId;
}
public AuthenticAccount getAccount()
{
return account;
}
public void setAccount(AuthenticAccount account)
{
this.account = account;
}
}
@Entity
@Table(name="CARD")
@SequenceGenerator(name="CARD_SEQUENCE",
sequenceName="CARD_SEQUENCE")
public class Card implements Serializable
{
@Id @GeneratedValue(strategy=GenerationType.SEQUENCE,
generator="CARD_SEQUENCE")
@Column(name="CRD_ID")
private long id;
@Column(name="CRD_PAN")
private String primaryAccountNumber;
@Column(name="CRD_STATUS_1")
private String status1 = "A";
@Column(name="CRD_CURRENT_PVV")
private long currentPvv = 0;
@Column(name="CRD_PIN_RETRY_COUNT")
private long pinRetryCount = 0;
@Column(name="CRD_CUSTOM_INDEX_1")
private String customIndex1 = "GC";
// Default values for all authentic test cards
@Column(name="CRD_CARD_SEQUENCE_NBR")
private long cardSequenceNumber = 0;
@Column(name="CRD_CPD_ID")
private long cpdId = 250;
@Column(name="CRD_LAST_SOURCE")
private String lastSource = "U";
@Column(name="CRD_FUNCTIONS")
private int functions = 1;
@Column(name="CRD_CURRENT_PIN_OFFSET")
private String currentPinOffset = "0";
@Column(name="CRD_ISSUE_DATE_1")
private Date issueDate1;
@Column(name="CRD_EXPIRY_DATE_1")
private Date expiryDate1;
@Column(name="CRD_EXPIRY_DATE_2")
private Date expiryDate2;
@Column(name="CRD_STATUS_1_DATE")
private Date status1Date;
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name="CRD_PRIMARY_ACN_ID", nullable=false, unique=true)
private AuthenticAccount account;
public Card()
{
this.issueDate1 = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss
a").parse("09/06/2005 12:00:00 AM", new ParsePosition(0));
this.expiryDate1 = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss
a").parse("01/06/2015 12:00:00 AM", new ParsePosition(0));
this.expiryDate2 = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss
a").parse("01/06/2015 12:00:00 AM", new ParsePosition(0));
this.status1Date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss
a").parse("09/06/2005 12:00:00 AM", new ParsePosition(0));
}
public String getPrimaryAccountNumber()
{
return primaryAccountNumber;
}
public void setPrimaryAccountNumber(String primaryAccountNumber)
{
this.primaryAccountNumber = primaryAccountNumber;
}
public long getCpdId()
{
return cpdId;
}
public void setCpdId(long cpdId)
{
this.cpdId = cpdId;
}
public String getCurrentPinOffset()
{
return currentPinOffset;
}
public void setCurrentPinOffset(String currentPinOffset)
{
this.currentPinOffset = currentPinOffset;
}
public long getCurrentPvv()
{
return currentPvv;
}
public void setCurrentPvv(long currentPvv)
{
this.currentPvv = currentPvv;
}
public String getCustomIndex1()
{
return customIndex1;
}
public void setCustomIndex1(String customIndex1)
{
this.customIndex1 = customIndex1;
}
public Date getExpiryDate1()
{
return expiryDate1;
}
public void setExpiryDate1(Date expiryDate1)
{
this.expiryDate1 = expiryDate1;
}
public Date getExpiryDate2()
{
return expiryDate2;
}
public void setExpiryDate2(Date expiryDate2)
{
this.expiryDate2 = expiryDate2;
}
public int getFunctions()
{
return functions;
}
public void setFunctions(int functions)
{
this.functions = functions;
}
public long getId()
{
return id;
}
public void setId(long id)
{
this.id = id;
}
public Date getIssueDate1()
{
return issueDate1;
}
public void setIssueDate1(Date issueDate1)
{
this.issueDate1 = issueDate1;
}
public String getLastSource()
{
return lastSource;
}
public void setLastSource(String lastSource)
{
this.lastSource = lastSource;
}
public long getPinRetryCount()
{
return pinRetryCount;
}
public void setPinRetryCount(long pinRetryCount)
{
this.pinRetryCount = pinRetryCount;
}
public long getCardSequenceNumber()
{
return cardSequenceNumber;
}
public void setCardSequenceNumber(long cardSequenceNumber)
{
this.cardSequenceNumber = cardSequenceNumber;
}
public String getStatus1()
{
return status1;
}
public void setStatus1(String status1)
{
this.status1 = status1;
}
public Date getStatus1Date()
{
return status1Date;
}
public void setStatus1Date(Date status1Date)
{
this.status1Date = status1Date;
}
public AuthenticAccount getAccount()
{
return account;
}
public void setAccount(AuthenticAccount account)
{
this.account = account;
}
}
Further more, when I try to remove an AUthentic entity (with logging set to WARN), I
find that the AuthenticMiniStatements
are not removed. This probably should be raised as another bug.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira