-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Post / Pre Filter result return when using SQLQuery
PostPosted: Sun Mar 24, 2013 8:44 am 
Newbie

Joined: Sun Nov 30, 2008 11:45 am
Posts: 2
Hi,
I have some DAO's that using SQLQuery for fetching data from database .
I have some application security requirement to filter the return results - this requirements is cross application, not for a single dao .

My dao's model objects are simple pojo's that not mapped by hibernate (not annotated with @Entity)

1. I tried to Implement LoadEventListener , and it seems that on runtime it execute just for @Entity objects bound to the session , but not for objects that not mapped by hibernate and using SQLQuery

2 .I also thought of using Interceptor but I dont sure there is a way to filter result return from database , I found this post on the same issue - not answered
Quote:
https://forum.hibernate.org/viewtopic.php?f=1&t=929687&view=previous


Is there is a way to dynamically change SqlQuery by adding a "where" / or another condition ? / Pre executing changing / manipulating the sql string result that will be generated by hibernate ?

Is there is a way to filter results by Hibernate Interceptor ?

Thanks in advance

_________________
Nir Bar-On


Top
 Profile  
 
 Post subject: Re: Post / Pre Filter result return when using SQLQuery
PostPosted: Tue May 28, 2013 7:41 am 
Newbie

Joined: Tue May 28, 2013 7:38 am
Posts: 1
I have handled to run my simulator in similar and recombined the situation.ep.i information and considered the outcome in ElmerPost, but I can't determine how to merge the outcomes information.

http://results.hamariweb.com/matriculation-results.aspx


Top
 Profile  
 
 Post subject: Re: Post / Pre Filter result return when using SQLQuery
PostPosted: Wed May 29, 2013 4:08 am 
Newbie

Joined: Sun Nov 30, 2008 11:45 am
Posts: 2
I succed to solve this ...
1. I extend EmptyInterceptor class .
2. override "onPrepareStatement" method , on this method I get the sql query generated by hibernate , before executing in the database.
3. in the override implementation of "onPrepareStatement" I used this artifact

<groupId>net.sf.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
<version>0.8.0</version>

for parse and manipulating sql query - in my case I add where condition .

_________________
Nir Bar-On


Top
 Profile  
 
 Post subject: Re: Post / Pre Filter result return when using SQLQuery
PostPosted: Thu May 30, 2013 3:37 am 
Newbie

Joined: Thu May 30, 2013 3:35 am
Posts: 1
nirb wrote:
I succed to solve this ...
1. I extend EmptyInterceptor class .
2. override "onPrepareStatement" method , on this method I get the sql query generated by hibernate , before executing in the database.
3. in the override implementation of "onPrepareStatement" I used this artifact

<groupId>net.sf.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
<version>0.8.0</version>

for parse and manipulating sql query - in my case I add where condition .


I will apply this thanks


Top
 Profile  
 
 Post subject: Re: Post / Pre Filter result return when using SQLQuery
PostPosted: Fri Jul 18, 2014 1:56 pm 
Newbie

Joined: Fri Jul 18, 2014 1:38 pm
Posts: 2
Is it worked for insertions into tables which has dependency on another database


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.