Uppala Ramana

+ Follow
since Jan 14, 2010
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Uppala Ramana

i am refering to this line @OneToMany(mappedBy="item")
what us mean mappedBy="item" ?


The mappedBy element identifies the inverse side of a relationship.

The inverse side of the bidirectional relationship (OneToOne,OneToMany,ManyToMany) refer to its owining side by using the mappedBy element.

In your example, mappedBy="item" is the inverse side of the relation that is Item-> Bids and Bid->Item is the Owning side.

To fetch Bid from object from the Item class, JPA uses the attribute or property specified in the mappedBy element.


You have to use transactions...to sync your persistent entities to databse.

}catch(Exception exception){


Caused by: java.lang.IllegalArgumentException: Object: SampleEntity.Customer@115441f is not a known entity type.

You have to declare your persistent classes in the persistent.xml like below:



The extended and transaction scoped are subtypes for the Container Managed Entity Manager. But what about Application Managed Entity Manager. Can't they also be transaction scoped or extended scoped? Correct me if I'm wrong

Hi Jothi,

There are two ways of using the EntityManager

1) Container Managed ::: Using Dependency Injection ...so the container is responsible for initializing the EntityManager
EntityManager entityManager;

2) Application Managed::: User or Application is Responsible for creating and initializing the EntityManager

EntityManagerFactory emf = Persistence.createEntityManagerFactory("MyUnit")
EntityManager em = emf.createEntityManager();

Now coming back to Transaction or Extended ..those are the Persistence Context Types.
Container Managed Entity Manager can have any of the below Persistent Context Type

EntityManager entityManager;

EntityManager em;

As far as i know, for the Application Managed Entity Manager ..application is responsible for managing the transactions.

But what about Application Managed Entity Manager. Can't they also be transaction scoped or extended scoped? Correct me if I'm wrong!

That dependes on the application code...i think there is no meaning of extended scope for the application managed entity manager.
Make sure java version of the client program is same as ejb deployed server java version.

Naming properties are need to be set to the context.

context = new InitialContext(properties);

I am new to use JNDI. I want to know, that how do we bound our object to a particular 'name', and what do we mean by that. Also, if binding to a name and then looking up using the name to obtain a reference to this object, does this mean that I can access to any object running on any JVM on the internet? Or it means that looking up and obtaining the reference is only meant for the same JVM on which JBoss/any server providing the JNDI service is running.

We can bind the object to a name by using the InitialContext's bind API.

You can lookup the object by using lookup(name) and this returns you the object that mapped to the name.

I think lookup only works for the same JVM.
I think that is up to the Application Server Implementation ..unless you have custom class loaders in your EAR

That's what I thought. That's why I asked you to do a little bit of thinking yourself. So... what does it mean to make a class final? What effect does it have on the class?

Clearly that effect prevents the ORM software from working correctly, and that's why it's prohibited


So, what the ORM software will do by creating a sub class of each Entity Bean ?
Is it will add some thing to each Entity ?


I want to know the reason behind the statement "The Entity Class Must Not Be Final".

"The Entity Class Must Not Be Final".This statement is in EJB3.0 specification.

Why is that the entity class must not be final ?