You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by alex_ro_bv <al...@yahoo.com> on 2008/05/07 11:39:27 UTC

General restrictions

Hi all, I was wondering if there is possible a general restriction for my
database using openJPA.
What I mean is that in my database all my tables have some common fields.
For example deletedflag. So I was wondering if is there any way to exclude
all these records in my business logic somehow. So for any query that I
execute via openJPA, a new condition should be implied, with deletedflag=0.
This should be applied for all the joins too. I was hoping for some easy
setting in orm.xml or something like that were I could add conditions for
all my tables but couldn't find any.
Thank you very much, for your response.
-- 
View this message in context: http://www.nabble.com/General-restrictions-tp17101067p17101067.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: General restrictions

Posted by alex_ro_bv <al...@yahoo.com>.
First of all, thanks for your reply.
Anyway, that was not the answer I was expecting :). I was hoping for
something like:
"Get the sources from openJPA and modify in class
org.apache.openJPA.kernel.QueryImpl the method.... adding a listener ...."
or something like that.... One way or another I have to achieve this.
Thanks, and if anyone knows a proper mode or modification in the source
code, please let me know.

Adam Hardy-5 wrote:
> 
> alex_ro_bv on 07/05/08 10:39, wrote:
>> Hi all, I was wondering if there is possible a general restriction for my
>> database using openJPA.
>> What I mean is that in my database all my tables have some common fields.
>> For example deletedflag. So I was wondering if is there any way to
>> exclude
>> all these records in my business logic somehow. So for any query that I
>> execute via openJPA, a new condition should be implied, with
>> deletedflag=0.
>> This should be applied for all the joins too. I was hoping for some easy
>> setting in orm.xml or something like that were I could add conditions for
>> all my tables but couldn't find any.
>> Thank you very much, for your response.
> 
> No there is no JPA capability for filters in the Hibernate sense. You
> could 
> implement GROUP BY ... HAVING in all your queries.
> 
> I would use database views.
> 
> 

-- 
View this message in context: http://www.nabble.com/General-restrictions-tp17101067p17125067.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: General restrictions

Posted by Adam Hardy <ad...@cyberspaceroad.org>.
alex_ro_bv on 07/05/08 10:39, wrote:
> Hi all, I was wondering if there is possible a general restriction for my
> database using openJPA.
> What I mean is that in my database all my tables have some common fields.
> For example deletedflag. So I was wondering if is there any way to exclude
> all these records in my business logic somehow. So for any query that I
> execute via openJPA, a new condition should be implied, with deletedflag=0.
> This should be applied for all the joins too. I was hoping for some easy
> setting in orm.xml or something like that were I could add conditions for
> all my tables but couldn't find any.
> Thank you very much, for your response.

No there is no JPA capability for filters in the Hibernate sense. You could 
implement GROUP BY ... HAVING in all your queries.

I would use database views.