[EJB/JBoss] - Re: Executing Outside Transaction
by murtuza52
I tried your approach, but it does not seems to working in concurrent access to methodA(). Let me explain, I ran test with two threads running almost parallel. Each thread making 100 calls to methodA(). At the end of the test the count should have increased by 200 but its not the case. Its always less than 200. When I looked deeper into the problem I found that two threads calling count() at same time (or before the current thread has written the new counter value to database) will read same counter value from the database. Thus both of them will result in writing same value in the database which is not right. There must be locking mechanism on the table or method which blocks others from access until current thread finishes the count() method. I tried synchronized but in vain.
I appreciate your help and hope to hear better solution from experts.
Murtuza
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3995020#3995020
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3995020
19 years, 4 months
[EJB 3.0] - Re: EJB QL requires useless item in select list
by owaind
org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the select list [FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=c,role=null,tableName=Channel,tableAlias=channel1_,origin=Request request0_,colums={request0_.channel_FK ,className=com.telepathyproof.adventure.ejb.entity.channel.Channel}}] [select c.id, sum(se.currentListeners) from com.telepathyproof.adventure.ejb.entity.stats.Request r inner join fetch r.channel c left join fetch r.stats s left join fetch s.statsEntries se where r.createdDate > :startDate and r.createdDate < :endDate]
at org.hibernate.hql.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:195)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3995017#3995017
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3995017
19 years, 4 months