unexpected token: 913705176
by Daniel Gradecak
Hi all,
My column in the database is varchar(30). The query I am using looks like :
Query query = session.createQuery("from Person pers inner join fetch
pers.party p inner join fetch p.contacts c inner join fetch
c.contactTelephones t where t.telNumber = "+telNum);
The variable telNum is String.
of course all the tables are mapped correctly (for sure).
When telNum does not have a 0 as leading character then everything is OK
but as soon as I put a leading 0 I got this exception ... why?
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: 913705176
near line 1, column 171 [from com.restartsystems.svarog.entity.Person
pers inner join fetch
pers.party p inner join fetch p.contacts c inner join fetch
c.contactTelephones t where t.telNumber = 0913705176]
18 years, 4 months
[Hibernate-JIRA] Created: (HHH-2039) ListType.indexOf doesn't work with DOM4J entities
by Alexander Kiel (JIRA)
ListType.indexOf doesn't work with DOM4J entities
-------------------------------------------------
Key: HHH-2039
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2039
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.1.3
Environment: Hibernate 3.1.3, HSQLDB
Reporter: Alexander Kiel
I try to save a entity (DOM4J mode) which contains a list:
<multiple-choice-task id="1">
...
<choices>
<choice id="2">
<task task-ref="1"/>
...
</choice>
<choice id="3">
<task task-ref="1"/>
...
</choice>
</choices>
</multiple-choice-task>
Mappings:
<list name="choices" lazy="true" inverse="false" cascade="all-delete-orphan"
node="choices">
<key column="taskid" not-null="true"/>
<list-index column="index"/>
<one-to-many class="....Choice"/>
</list>
<class name="....Choice" table="choice" node="choice">
<id name="id" column="id" unsaved-value="null" node="@id">
<generator class="hilo"/>
</id>
<many-to-one name="task" insert="false" update="false"
node="task/@task-ref" embed-xml="false">
<column name="taskid" not-null="true"/>
</many-to-one>
...
</class>
If I save the multiple-choice-task with Hibernate 3.1.3 I get following
Exception:
java.lang.ClassCastException: org.dom4j.tree.DefaultElement
at org.hibernate.type.ListType.indexOf(ListType.java:49)
at org.hibernate.engine.StatefulPersistenceContext.getIndexInParent(StatefulPersistenceContext.java:1066)
at org.hibernate.engine.StatefulPersistenceContext.getIndexInOwner(StatefulPersistenceContext.java:1041)
at org.hibernate.property.IndexPropertyAccessor$IndexGetter.getForInsert(IndexPropertyAccessor.java:74)
at org.hibernate.tuple.AbstractEntityTuplizer.getPropertyValuesToInsert(AbstractEntityTuplizer.java:264)
at org.hibernate.persister.entity.AbstractEntityPersister.getPropertyValuesToInsert(AbstractEntityPersister.java:3331)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:244)
Sourcecode of ListType.indexOf:
public Object indexOf(Object collection, Object element) {
List list = (List) collection;
for ( int i=0; i<list.size(); i++ ) {
//TODO: proxies!
if ( list.get(i)==element ) return new Integer(i);
}
return null;
}
The problem is that the collection is in DOM4J mode a Element with doesn't
implement List. In my example collection is the <choices> Element and
element is one of the <choice> Elements.
I suggest following FIX:
public Object indexOf(Object collection, Object element) {
if (collection instanceof List) {
int index = ((List) collection).indexOf(element);
return index == -1 ? null : new Integer(index);
} else if (collection instanceof Element) {
int index = ((Element) collection).content().indexOf(element);
return index == -1 ? null : new Integer(index);
} else {
throw new IllegalArgumentException("collection type not supported.");
}
}
It works for me.
By the way:
Why bother with a own for loop and own comparison?
Because of equals()?
list.get(i) can be much more costly on non RandomAccess lists than an
unnessesary equals().
Please fix this issue in the next release. I have to work with the SVN Version
and my own fix until than. I have a production system to which I want to add
XML backup/restore.
Thanks.
Alexander Kiel
--
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
18 years, 4 months
[Hibernate-JIRA] Created: (HHH-2038) Invalid SQL generated for HQL on a Map
by Daniel Serodio (JIRA)
Invalid SQL generated for HQL on a Map
--------------------------------------
Key: HHH-2038
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2038
Project: Hibernate3
Type: Bug
Components: query-hql
Versions: 3.0.5
Environment: Hibernate 3.0.5, HypersonicSQL 1.8.0.4
Reporter: Daniel Serodio
Attachments: hbm-bug-with-map.zip
I have two classes linked by a bidirectional one-to-many, and a Map<String,String> on the "many" side.
When I run the following HQL query (using Hibernate Tools), the generated SQL has the correct "joins", but doesn't include the table for the "many" side in the "from" clause .
from Cheque as cheque
where cheque.situacoes.contexto['foo'] = 'bar'
Gives:
Column not found: SITUACOES1_.SITUACAO_ID in statement [select cheque0_.id as id0_ from cheque cheque0_, dados_contexto contexto2_ where situacoes1_.situacao_id=contexto2_.situacao_id and contexto2_.chave = 'foo' and cheque0_.id=situacoes1_.cheque_id and contexto2_.valor='bar']
If I add change the query to
from Cheque as cheque
inner join cheque.situacoes as situacoes
where cheque.situacoes.contexto['foo'] = 'bar'
The generated SQL is different, but the error is the same:
Column not found: SITUACOES1_.SITUACAO_ID in statement [select cheque0_.id as id0_0_, situacoes1_.situacao_id as situacao1_1_1_, situacoes1_.data_inicio as data2_1_1_, situacoes1_.data_fim as data3_1_1_, situacoes1_.cheque_id as cheque4_1_1_ from cheque cheque0_ inner join situacoes situacoes1_ on cheque0_.id=situacoes1_.cheque_id, dados_contexto contexto3_ where situacoes2_.situacao_id=contexto3_.situacao_id and contexto3_.chave = 'foo' and cheque0_.id=situacoes2_.cheque_id and contexto3_.valor='bar']
I've searched the forums, and found this similar post: http://forum.hibernate.org/viewtopic.php?p=2320400
I've searched Jira, and found nothing. I've narrowed it down and I'm attaching the relevant files, it should be trivial to duplicate.
--
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
18 years, 4 months
[Hibernate-JIRA] Commented: (ANN-298) ClassCastExcepton: java.lang.Long at org.hibernate.type.ComponentType.toLoggableString
by Mike Lindenblatt (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-298?page=co... ]
Mike Lindenblatt commented on ANN-298:
--------------------------------------
We have a similar problem:
java.lang.ClassCastException: org.dom4j.tree.DefaultElement
at org.hibernate.type.ComponentType.toLoggableString(ComponentType.java:329)
at org.hibernate.pretty.MessageHelper.infoString(MessageHelper.java:68)
at org.hibernate.persister.entity.AbstractEntityPersister.getDatabaseSnapshot(AbstractEntityPersister.java:975)
at org.hibernate.engine.StatefulPersistenceContext.getDatabaseSnapshot(StatefulPersistenceContext.java:304)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:189)
at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:460)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:84)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:520)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:513)
Session is created in DOM4J EntityMode:
Session dom4jSession = s.getSession(EntityMode.DOM4J);
> 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
18 years, 4 months
[Hibernate-JIRA] Commented: (ANN-298) ClassCastExcepton: java.lang.Long at org.hibernate.type.ComponentType.toLoggableString
by Mike Lindenblatt (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/ANN-298?page=co... ]
Mike Lindenblatt commented on ANN-298:
--------------------------------------
we see the ClassCastException ONLY in DEBUG-Mode
> 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
18 years, 4 months
[Hibernate-JIRA] Commented: (EJB-174) Ejb3Configuration can't open EJB Jar file with persistence.xml in Oracle OC4J server (Jifeng Liu)
by Jifeng Liu (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/EJB-174?page=co... ]
Jifeng Liu commented on EJB-174:
--------------------------------
Thanks! I tested it and it works.
> Ejb3Configuration can't open EJB Jar file with persistence.xml in Oracle OC4J server (Jifeng Liu)
> -------------------------------------------------------------------------------------------------
>
> Key: EJB-174
> URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-174
> Project: Hibernate Entity Manager
> Type: Bug
> Components: EntityManager
> Versions: 3.1.0.Beta8
> Environment: Hibernate core 3.2rc1; Hibernate Annotation 3.1.0 beta 10
> Oracle OC4J 10.1.13
> Oracle 9
> Reporter: Jifeng Liu
> Assignee: Emmanuel Bernard
> Priority: Minor
> Fix For: 3.2.0.cr2
>
>
> In Oracle OC4J server, I created an EJB jar file, ejbSenior.jar, and put persistence.xml in its /META-INF folder. After deploying this EJB jar, I called javax.persistence.Persistence.createEntityManagerFactory("hibernate"). I got the following debug information and exception stack trace:
> 14:36:23 DEBUG Ejb3Configuration - Archive to be processed by hibernate Entity Manager implementation found
> 14:36:23 DEBUG JarVisitor - Searching mapped entities in jar/par: code-source:/C:/my/ws31/NewOC4J/ora92/j2ee/home/applic
> ations/SeniorApps/ejbSenior.jar
> 14:36:23 DEBUG Ejb3Configuration - Persistence unit name: hibernate
> 14:36:23 DEBUG Ejb3Configuration - emname:hibernate metadata: hibernate
> 14:36:23 WARN InputStreamZippedJarVisitor - Unable to find file (ignored): code-source:/C:/my/ws31/NewOC4J/ora92/j2ee/h
> ome/applications/SeniorApps/ejbSenior.jar
> java.io.IOException: code-source:/C:/my/ws31/NewOC4J/ora92/j2ee/home/applications/SeniorApps/ejbSenior.jar has no "!<pat
> h>" suffix so does not name a path within the code-source.
> at oracle.classloader.SharedCodeSourceSet.getResourceStream(SharedCodeSourceSet.java:482)
> at oracle.classloader.SharedCodeSourceURL$Connection.getInputStream(SharedCodeSourceURL.java:93)
> at java.net.URL.openStream(URL.java:1007)
> at org.hibernate.ejb.packaging.InputStreamZippedJarVisitor.doProcessElements(InputStreamZippedJarVisitor.java:33)
> at org.hibernate.ejb.packaging.JarVisitor.getMatchingEntries(JarVisitor.java:208)
> at org.hibernate.ejb.Ejb3Configuration.addMetadataFromVisitor(Ejb3Configuration.java:201)
> at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:183)
> at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:114)
> at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
> at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27)
> at com.senior.dal.shared.util.HbSessionFactory.getEntityManagerFactory(HbSessionFactory.java:40)
> After debugging it, I found Oracle OC4J's class loader creates a special URL with protocol 'code-source'. You can use this URL to get any resource inside EJB jar file. But you can't use it to read the EJB jar file itself.
> I wrote a small patch to fix it by changing the URL to an URL pointing to a file:
> In org.hibernate.ejb.packaging.JarVisitor java file, I add new code between "patch begins" and "patch ends" comment:
> public static final URL getJarURLFromURLEntry(URL url, String entry) throws IllegalArgumentException {
> URL jarUrl;
> String file = url.getFile();
> if ( ! entry.startsWith( "/" ) ) entry = "/" + entry;
> file = file.substring( 0, file.length() - entry.length() );
> if ( file.endsWith( "!" ) ) file = file.substring( 0, file.length() - 1 );
> try {
>
> if ( "jar".equals( url.getProtocol() ) ) {
> jarUrl = new URL( file );
> }
> // patch starts
> else if ("code-source".equals( url.getProtocol() ) ) {
> jarUrl = new File(file).toURL();
> }
> // patch ends
> else {
> jarUrl = new URL( url.getProtocol(), url.getHost(), url.getPort(), file );
> }
> }
> catch (MalformedURLException e) {
> throw new IllegalArgumentException(
> "Unable to determine JAR Url from " + url + ". Cause: " + e.getMessage()
> );
> }
> return jarUrl;
> }
--
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
18 years, 4 months