You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by aaaaaa <aa...@trash2009.com> on 2009/08/24 02:35:51 UTC

replacing sql?...

hi all,
can I change sql statement which is about to be executed at @prepersist? 
thanks,

Alex.

-- 
View this message in context: http://n2.nabble.com/replacing-sql-tp3500738p3500738.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: replacing sql?...

Posted by Kevin Sutter <kw...@gmail.com>.
Hi,
Updating an Entity in the @prepersist or @preupdate method is permitted.
This was previously discussed on the dev forum [1] with the JIRA [2]
resolved for the 1.2.x, 1.3.x, and trunk branches.  Are you finding that
this support is not working for you, or were you just asking the question?

These type of updates to the Entity will affect the sql that is generated.
But, I agree with Jody that OpenJPA does not allow direct manipulation of
the generated sql.

Kevin

[1]
http://n2.nabble.com/Updates-to-entities-via-Lifecycle-callback-methods-td1110631.html
[2]  https://issues.apache.org/jira/browse/OPENJPA-732

On Mon, Aug 24, 2009 at 11:40 AM, aaaaaa <aa...@trash2009.com> wrote:

>
> for example, when I delete User entity I need to set active = false ,
> instead
> of actually deleting the record.
>
>
>
>
> Jody Grassel wrote:
> >
> > I don't think that the SQL generated by OpenJPA entitymanager operations
> > can be directly modified.  What sort of modifications are you looking
> > for?  There might be supported function to direct OpenJPA to create the
> > sort of SQL that you are looking for.
> >
> > On Sun, 2009-08-23 at 19:35 -0500, aaaaaa wrote:
> >> hi all,
> >> can I change sql statement which is about to be executed at @prepersist?
> >> thanks,
> >>
> >> Alex.
> >>
> >
> >
> >
>
> --
> View this message in context:
> http://n2.nabble.com/replacing-sql-tp3500738p3504648.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Re: replacing sql?...

Posted by Edoardo Panfili <ed...@aspix.it>.
On 24/08/09 18:40, aaaaaa wrote:
>
> for example, when I delete User entity I need to set active = false , instead
> of actually deleting the record.

can't you set the attibute "active = false" and then use normal 
persistence instead of delete?

During user search you can set "active = true" in the search pattern...

I misunderstand?

Edoardo

>
> Jody Grassel wrote:
>>
>> I don't think that the SQL generated by OpenJPA entitymanager operations
>> can be directly modified.  What sort of modifications are you looking
>> for?  There might be supported function to direct OpenJPA to create the
>> sort of SQL that you are looking for.
>>
>> On Sun, 2009-08-23 at 19:35 -0500, aaaaaa wrote:
>>> hi all,
>>> can I change sql statement which is about to be executed at @prepersist?
>>> thanks,
>>>
>>> Alex.
>>>
>>
>>
>>
>


Re: replacing sql?...

Posted by aaaaaa <aa...@trash2009.com>.
for example, when I delete User entity I need to set active = false , instead
of actually deleting the record.




Jody Grassel wrote:
> 
> I don't think that the SQL generated by OpenJPA entitymanager operations
> can be directly modified.  What sort of modifications are you looking
> for?  There might be supported function to direct OpenJPA to create the
> sort of SQL that you are looking for.
> 
> On Sun, 2009-08-23 at 19:35 -0500, aaaaaa wrote:
>> hi all,
>> can I change sql statement which is about to be executed at @prepersist? 
>> thanks,
>> 
>> Alex.
>> 
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/replacing-sql-tp3500738p3504648.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: replacing sql?...

Posted by Jody Grassel <fy...@gmail.com>.
I don't think that the SQL generated by OpenJPA entitymanager operations
can be directly modified.  What sort of modifications are you looking
for?  There might be supported function to direct OpenJPA to create the
sort of SQL that you are looking for.

On Sun, 2009-08-23 at 19:35 -0500, aaaaaa wrote:
> hi all,
> can I change sql statement which is about to be executed at @prepersist? 
> thanks,
> 
> Alex.
>