Win a copy of Spring Boot in Practice this week in the Spring forum!

Anurag Bhatia

Greenhorn
+ Follow
since May 12, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anurag Bhatia

I have and 2 files deployed on my jboss-4.2.2.GA server -

100project.ear (which contains other jar files)
200mbean.sar

I have to call a method in a pojo (which in turn calls an EJB Session bean) from one of the jars residing in the ear file. If I call the method directly from the sar then I get a ClassNotFoundException (no suprises there). I tried adding the jar to be called to the sar manifest.mf classpath but that did not work either. How do I make the sar call the method correctly?

--Anurag
11 years ago
Thanks. That sorted it out.
In one EJB I am doing the following operations -
1. Create entity A with primary key - id and persist A into the database.
2. Look for entity A with primary key - id.

When I do operation 2 I get a an ObjectNotFound exception. I am unable to understand why?
Should'nt the entity manager be aware of the created entity A with primary key - id.

--Anurag
I am trying to deploy one persistence.xml in my ear file for all the ejb jars. I have tried placing the persistence.xml in the top level directory of ear file and also in the meta-inf directory in the ear file. Neither one has worked. I am using jboss-4.2.2.GA. Any suggestions?
11 years ago
I used the <jar-file> tag in the second jar file. That made it work.
I am trying to do a join on 2 entities AttrEntity and DescEntity. The problem is that the AttrEntity and DescEntity are in different jar files so when I execute the query I get an exception saying that the entity DescEntity was not found. Is there anyway I can execute this query while not modifying my jar files?
I am using the hibernate second level cache for my ejb3 entity beans for entity caching as well as query caching. Does anyone have any idea on how to invalidate the hibernate second level cache?
I tried to use the evictXXXX() methods in the sessionfactory but had no success.

--Anurag
I've tried using a name query but I run into the same problem of transactions. I am already caching the query results.
I have a bunch of queries in my stalesssession bean that is called quite frequently. I am trying to resuse the query but I keep running into problems with transactions.

A method in my bean -

public List foo()
{
Query query = entityManger.createQuery(queryStr); -> This call takes quite a bit of time
-> If I declare the query as a memeber variable and initialize it in the @PostContruct method
-> the second time I run into a transaction issue. How can I avoid that?
-> My aim is to remove the calls to entityManager.createQuery to speed up the method and to reuse the query
query.setParameter("test","test");
return query.getResultList();
}
Hi Arvind,

Did you figure out any solution to the issue? I am having the same problem.

Try - http://docs.jboss.org/ejb3/docs/tutorial/1.0.7/html/EJB2.1_and_EJB3_references.html

--Anurag

Hi All,

I am in the process of migrating from EJB 2.1 to EJB 3.0. I had a whole bunch of queries for by entity-beans which were defined in ejb-jar.xml. Once I move to EJB 3.0 I cannot seem to figure out where should those queries go - do I keep them as String in the form of NamedQueries using the @NamedQuery annotations or do I keep them in some xml. Is there any recommendation?

--Anurag
In case someone else ran into the same issue; you need to get all the relevant jars that you need one by one from the jboss libs instead of using the jboss-all client jar.
11 years ago
Hi All,

I am looking for resources to configure entity caching in for EJB 2.1 on Jboss 4.2.2. I tried searching on google but I could not find any concrete data on procedures and pros/cons.

Thanks and regards,
Anurag Bhatia
11 years ago
I am currently using jboss-4.2.2.GA. I have a client that has to do a remote lookup on the jbos server to get some info and then persist it onto it's own db using hibernate 3.4.
The jbossall-client.jar is on the build path of the client; there is a class AnnotationConfiguration that is there on the in the hibernate-annotations lib that clashes with the AnnotationsConfiguration in the jbossall-client.jar. Since I placed the jbossall-client on the build ; I keep getting a NoSuthMethodError Exception on the AnnotationsConfiguration class when I try and initialize the db.
I am not sure how to proceed. I cannot write a custome class loader as the hibernate code is not in my control.
12 years ago