Priya Venkatesan

Ranch Hand
+ Follow
since Nov 02, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Priya Venkatesan

Hi,
I am new to the spring integration and would like to get a "Big picture" of the events framework. I see that there are lot of documentation but I did not find any architecture "view" diagram. Can somebody point me to that if there is one?

Thanks.
Using JBOSS optimistic tree cache and Websphere 6.1.0.13

Hi,
While trying to use hibernate 3.2.5 with WAS 6.1.0.13 I am facing these issues:
My hibernate cfg file has the transaction manager set up to be
org.hibernate.transaction.WebSphereExtendedJTATransactionLookup which is recommended while using hibernate with Websphere 6.1. I am using CMT transaction manager factory. However this gives me the error:

caused by: java.lang.UnsupportedOperationException
at
org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter.suspend(WebSphereExtendedJTATransactionLookup.java:111)
at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:78)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67)
at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:80)
at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:4241)
... 40 more

Then going through JBOSS discussion boards, I understood that I need to set the transaction manager to be org.hibernate.transaction.WebSphereTransactionManagerLookup
which is meant to be used for lower versions of websphere. By doing so, this error disppeared, however I got the following problem while using optimistic tree cache.

[1/25/08 11:49:45:664 PST] 00000029 RegisteredSyn E WTRN0074E: Exception caught frombefore_completion synchronization operation: org.jboss.util.NestedRuntimeException: ; -

nested throwable: (org.jboss.cache.lock.TimeoutException: write lock for / could not be

acquired after 15000 ms. Locks: Read lock owners: {}
Write lock owner: GlobalTransaction:<null>:1
(caller=GlobalTransaction:<null>:2, lock info: write owner=GlobalTransaction:<null>:1

(activeReaders=0, activeWriter=Thread[QTMSessionPool,5,], waitingReaders=0,

waitingWriters=1, waitingUpgrader=0)))
at

org.jboss.cache.interceptors.TxInterceptor$LocalSynchronizationHandler.beforeCompletion(

TxInterceptor.java:1022)
at

org.jboss.cache.interceptors.OrderedSynchronizationHandler.beforeCompletion(OrderedSynch

ronizationHandler.java:72)
at

com.ibm.ws.Transaction.JTA.RegisteredSyncs.distributeBefore(RegisteredSyncs.java:242)
at

com.ibm.ws.Transaction.JTA.TransactionImpl.prePrepare(TransactionImpl.java:2389)
at

com.ibm.ws.Transaction.JTA.TransactionImpl.stage1CommitProcessing(TransactionImpl.java:1

622)
at

com.ibm.ws.Transaction.JTA.TransactionImpl.processCommit(TransactionImpl.java:1593)
at com.ibm.ws.Transaction.JTA.TransactionImpl.commit(TransactionImpl.java:1528)
at com.ibm.ws.Transaction.JTA.TranManagerImpl.commit(TranManagerImpl.java:237)
at com.ibm.ws.Transaction.JTA.TranManagerSet.commit(TranManagerSet.java:162)
at com.ibm.ejs.csi.TranStrategy.commit(TranStrategy.java:756)
at com.ibm.ejs.csi.TranStrategy.postInvoke(TranStrategy.java:181)
at

com.ibm.ejs.csi.TransactionControlImpl.postInvoke(TransactionControlImpl.java:581)
at com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:3910)
at

com.ibm.ejs.container.MessageEndpointHandler.afterDelivery(MessageEndpointHandler.java:1

353)
at

com.ibm.ejs.container.MessageEndpointHandler.invokeMessageEndpointMethod(MessageEndpoint

Handler.java:775)
at

com.ibm.ejs.container.MessageEndpointHandler.invoke(MessageEndpointHandler.java:736)
at $Proxy0.afterDelivery(Unknown Source)
at

com.ibm.ws.sib.ra.inbound.impl.SibRaTransactionalDispatcher.afterDelivery(SibRaTransacti

onalDispatcher.java:468)
at

com.ibm.ws.sib.ra.inbound.impl.SibRaDispatcher.dispatch(SibRaDispatcher.java:720)
at

com.ibm.ws.sib.ra.inbound.impl.SibRaSingleProcessListener$SibRaWork.run(SibRaSingleProce

ssListener.java:584)
at com.ibm.ejs.j2c.work.WorkProxy.run(WorkProxy.java:418)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)
Caused by: org.jboss.cache.lock.TimeoutException: write lock for / could not be acquired

after 15000 ms. Locks: Read lock owners: {}
Write lock owner: GlobalTransaction:<null>:1
(caller=GlobalTransaction:<null>:2, lock info: write owner=GlobalTransaction:<null>:1

(activeReaders=0, activeWriter=Thread[QTMSessionPool,5,], waitingReaders=0,

waitingWriters=1, waitingUpgrader=0))
at org.jboss.cache.lock.IdentityLock.acquireWriteLock(IdentityLock.java:169)
at org.jboss.cache.TreeNode.acquireWriteLock(TreeNode.java:546)
at org.jboss.cache.TreeNode.acquire(TreeNode.java:506)
at

org.jboss.cache.interceptors.OptimisticLockingInterceptor.lockNodes(OptimisticLockingInt

erceptor.java:141)
at

org.jboss.cache.interceptors.OptimisticLockingInterceptor.invoke(OptimisticLockingInterc

eptor.java:68)
at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:67)
at

org.jboss.cache.interceptors.TxInterceptor.runPreparePhase(TxInterceptor.java:754)
at

org.jboss.cache.interceptors.TxInterceptor$LocalSynchronizationHandler.beforeCompletion(

TxInterceptor.java:1000)
... 21 more

Can somebody tell me what is wrong?

Thanks,
Priya
I am trying to use hibernate second level cache and was looking to see what Cache provider to choose. After reading about Oscache, I thought in general it seems to be cluster aware. However hibernate's docs (http://www.hibernate.org/hib_docs/reference/en/html/performance.html#performance-cache) does not say that org.hibernate.cache.OSCacheProvider is cluster safe. What does this mean? Can I not use this in clustered environment?

Thanks,
Priya
17 years ago
Shailesh,
Only after trying out I recognized hibernate's problem. Still uncertain about other alternatives, I raised this question in the forum.
Basically, when I do this I get the "java.lang.ExceptionInInitializerError" error and the detailed stackTrace specfies that "Id" needs to be specified for the subclass (which B).Since the inheritence strategy used is "table per subclass"(joined subclass), hibernate does not need to know about the PK for B. This gives me a feeling that hibernate is not recognizing B's parent class.

If I used mappings only, then the mapping for A would contain the joined-subclass element.
If I used annotations only, then A would have @Inheritence(strategy=InheritanceType.JOINED).
Since this information is missing by mixing annotations and mapping, hibernate is confused!


I guess this is what they are trying to convey in the docs:

"You cannot mix configuration strategies (hbm vs annotations) in a mapped entity hierarchy either."

I am not sure... :-)

Any thoughts is very much appreciated.
I am new to annotations and would like to know if its possible to mix annotations with mappings while using inheritance strategies.

For (e.g) if I have a hbm mapping file say A.hbm.xml
Can I extend A and annotate it?

Specifically, can I do something like this:

@Entity
@Table(name="B")
@PrimaryKeyJoinColumn(name=B_id")
public class B extends A
{

@Column(name="newCol", nullable=true, length=50)
private String newCol;
...
}

class A does not have any annotations, just A.hbm

A.hbm:

<class name="com.my.object.A" >
...

<property name="name" column="name" ...>
</class>

Generally can I do something like this for any mapping strategy?

I read this line in the annotations docs and did not quiet understand:
"You cannot mix configuration strategies (hbm vs annotations) in a mapped entity hierarchy either"

Does this mean I cannot do what I am wanting to do?
Thanks for all your response. I got this figured out. All that I had to do was to map B to same table as its parent and specify polymorphism="explicit" in order for hibernate to return only instances of B.

I found my solution here:

http://www.hibernate.org/41.html
Can you please add more clarification?
I have a legacy application which we are migrating to hibernate and
I have a situation where a non peristable POJO extends a persistable POJO and this non persistable is passed on to an API which is then persisted using the hibernate API.

(e.g) B extends A

public createObject(A a)
{
//get hibernate sessionFactory, session
session.save(a);
}

Code which makes use of this API

public void caller(B b)
{
createObject(b);
}

This obviously is not working since hibernate is looking for a mapping for B which I do not have. Is there a way to make this work?
Iam pretty new to the JPA world, so please excuse if this question is dumb.
I would like to use JPA and came across HibernateEntityManager which is an implementation of EJB3. I also saw that Websphere 6.1.0.3 and Weblogic 9.2 support JPA.However Websphere 6.1.0.3 needs a Feature pack which has "preliminary" implementation of EJB3. Now, is it possible to integrate hibernate Entity Manager with Websphere 6.1/Weblogic 9.2 and use that instead of either Weblogic's or Websphere's JPA implementation? I read this in IBM developer works page and not sure what they mean by this...

�Hibernate's JPA support provides for JPA standard persistence and is a good alternative to the proprietary Hibernate APIs. Hibernate's JPA implementation requires a Java SE 5 based runtime, and therefore only runs on WebSphere Application Server V6.1 or later. At the time of publication, Hibernate's JPA support does not run on WebSphere z/OS and iSeries platforms. The Hibernate documentation describes how to package and deploy applications using Hibernate's JPA implementation.�

Does this mean HibernateEntityManager can work with Websphere 6.1?
Sorry for not being clear.
If I had the following mapping...
<property name="cost" type="big_decimal" precision="8" scale="2" not-null="true" lazy="false"/>
<property name="size" type="int" column="size" length="10" not-null="true" lazy="false"/>

then while trying to delete the object with only "id" value set, complains that the not-null values for cost and size has to be set...

org.hibernate.PropertyValueException
Original message: not-null property references a null or transient value:

Not sure why hibernate needs all the not null properties to be set just to delete. It would be nice if it can perform the delete function when I pass in the object id.

One more question on this...
If I had a hibernate mapping which uses table per subclass strategy, something like:

<class name="com.abc.A" table="ABC" lazy="false">
.....
<joined-subclass name="com.abc.MyA" extends="com.abc.A" table="XYZ" lazy="false">
<key column = "ID"/>
<property name="branchNumber" type="string" column="branchNumber" length="20" not-null="false" lazy="false"/>
</joined-subclass>
</class>

and wrote a "delete" HQL to delete the MyA object, then it seems like hibernate would not delete records from both ABC and XYZ table. This seems to be working when I use session.delete(MyA). The error that I get while using the delete HQL is...

<Exception occurred
<com.chordiant.service.ServiceException: Unexpected Exception deleting a browse record: could not insert/select ids for bulk delete

Original exception: org.hibernate.exception.SQLGrammarException

Original message: could not insert/select ids for bulk delete

Original exception stack trace:

org.hibernate.exception.SQLGrammarException: could not insert/select ids for bulk delete

at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)

at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)

Any thoughts on these?




If I had an object with not-null attribute set to true, then while trying
when making use of session.delete(obj) inorder to delete an object, it seems like all the not null fields have to be set on the object to be deleted. Is it not enough if we just set the id?
Can someone tell me how the pessimistic locking mechanism is implemented by the Hibernate Entity Manager?
Can someone tell me how do Create/Update/Retrieve operations on a CLOB/BLOB column using hibernate 3 on a DB2? Is there any dependency on the driver to manipulate the CLOB/BLOB datatype?
My understanding is that hibernate annotations can be used independently of EJB3 implementation. In the future if I were to move away from hibernate, can I use this same POJO annotated using hibernate annotations with another EJB3 implementation(other than Hibernate Entity Manager? Or is there any dependency on the Hibernate core?