Arunsanjay Jayarathanam

Greenhorn
+ Follow
since Oct 17, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Arunsanjay Jayarathanam

I believe your intention is to use the Company Id as one of the properties to uniquely identify an employee.
In order to do that , you need to have an IdClass composite of the properties ( empid, companyid) that uniquely
identify the employee in a separate class; and Have a relationship with the Company entity in the
Employee entity and as well use it as @Id property. Something like ,


(Note : the above code might not be the exact code, but something in the same lines. refer to the below link for details)
Refer to JPA Composite Primary Keys, for detailed explanation.

Go through the JPA 2.0 examples in the above link
If I haven't misunderstood your problem, I think you are looking for a one to many unidirectional relationship without using an intermediate class as well without an intermediate table in the database?? Assuming that is right,here is an example that provides you a solution

JPA Wiki
Can you give us more details about the error that occurs??

Ravi Kiran Va wrote:I currently dont remember exactly how to do this , but as per my knowledge you need to google on
"Configuring MDB Message Selectors"

and for this to work you need to set Header properties to your Message also .

Google it you will find it .



before sending a message to a queue or topic add a property to it which would uniquely identify it like

.
.
ObjectMessage obj = session.createObjectMessage();
obj.setStringProperty("type","XYZ");
.
.

and when configuring the listener or the mdb to listen to a queue and pickup only messages which have type "XYZ"

String messageSelector = "type = 'XYZ'"
TopicSubscriber sub = session.createSubscriber(topicName,messageSelector,true);

there are numerous operators other than '=', you can even do a wildcard match for the messageSelector like "'type LIKE 'XYZ%'"
this is with reference to ActiveMQ. the creation of subscriber might vary depending upon the third party provider.
i would suggest to start of with EJB .30. A good book for those who are new can be http://www.amazon.com/EJB-Developer-Guide-developers-architects/dp/1847195601/ref=sr_1_8?s=books&ie=UTF8&qid=1287332818&sr=1-8

It explains the concepts well alongwith detailed examples.