Hello,
I have been working with JPA from past few months.
Recently, I am involved in writing EJB3 statless bean, Interceptor & JPA.
Before manager's (statless bean's) method gets invoked, I am intercepting it through interceptor.
In my manager method, I am annotating some arguments (entities) as
a custom annotation.
In my interceptor, i need to check if that argument (entity) exists in Data Base or not.
For normal entites, i know, i can perform it like this:
But , I have more than 100 methods spread across some 10 - 15 managers ( with 30- 40 entities ) !
& I feel this will surely be a cross cutting concern ...
I have decided to go like this :
In My interceptor though, I get only
and i need to check if that object (which is actually entity) actually exists in a data base or not
Hope I am clear with my requirement ...
My questions are following: Is there a way in JPA API,
1) To check if the is an entity or not
2) To fetch the primary key dynamically from as
3) If above 2 do not exist, a way to check if entity exists in DB, in some other manner, which solves my requirement
Thanks a lottt
Thanks in advance .....
Waiting for your valuable response ...
Regds,
Vikas