You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by ma...@poczta.onet.pl on 2009/02/19 13:37:02 UTC

Removing entity with Embedded field

Hi,

I have a following beans:

@Embeddable
class A {
int field1
}

@Entity
class B {
@Id
long id;

int field2

@Embedded
A field3
}

When I trying to delete all instances of B entity from data storage by
"delete from B" I got:

1. Query ("select" statement) for all B instances
2. For each instance from 1. delete statement

Why this is not delete by simple "delete from B" sql statement?

Regards,
Marcin

Re: Re: Removing entity with Embedded field

Posted by Pinaki Poddar <pp...@apache.org>.
Hi,
  Yes -- the change is committed on trunk so you will need snapshot build.
The SVN revision is 746640. Because openjpa library is 'self-describing',
once you download, you can verify whether it contains a requisite change by 
$ java -jar /path/to/openjpa/jar
will print few details including the latest SVN revision number contained in
this library.   


maniek45 wrote:
> 
> Hi Pinaki,
> 
> How can I verify the issue? Shall I download daily snapshot?
> 
> Regards,
> Marcin
> 
>  
> users@openjpa.apache.org napisaƂ(a): 
>  > 
>  > I had put a fix for this issue recently OPENJPA-935. 
>  > Will the original reporter please verify?
>  > 
>  > OpenJPA makes a decision during bulk delete whether the delete
> operation
>  > involves a single table only. That decision was not accounting for
> cascade
>  > behavior for embedded fields. 
>  > 
>  > [1] http://issues.apache.org/jira/browse/OPENJPA-935
>  > 
>  > 
>  > 
>  > Jeremy Bauer wrote:
>  > > 
>  > > Hi Marcin,
>  > > 
>  > > I observe the same behavior when the base entity contains an
> embeddable.
>  > > Without an embeddable, the provider issues a single delete (as
> expected).
>  > > Since OpenJPA is operating on a single table, I don't see why
> multiple
>  > > deletes are necessary.  Unless I'm missing something, this appears to
> be a
>  > > bug in the provider.  Please open a JIRA.
>  > > 
>  > > -Jeremy
>  > > 
>  > > On Thu, Feb 19, 2009 at 6:37 AM, <ma...@poczta.onet.pl> wrote:
>  > > 
>  > >> Hi,
>  > >>
>  > >> I have a following beans:
>  > >>
>  > >> @Embeddable
>  > >> class A {
>  > >> int field1
>  > >> }
>  > >>
>  > >> @Entity
>  > >> class B {
>  > >> @Id
>  > >> long id;
>  > >>
>  > >> int field2
>  > >>
>  > >> @Embedded
>  > >> A field3
>  > >> }
>  > >>
>  > >> When I trying to delete all instances of B entity from data storage
> by
>  > >> "delete from B" I got:
>  > >>
>  > >> 1. Query ("select" statement) for all B instances
>  > >> 2. For each instance from 1. delete statement
>  > >>
>  > >> Why this is not delete by simple "delete from B" sql statement?
>  > >>
>  > >> Regards,
>  > >> Marcin
>  > >>
>  > > 
>  > > 
>  > 
>  > -- 
>  > View this message in context:
> http://n2.nabble.com/Removing-entity-with-Embedded-field-tp2354162p2374113.html
>  > Sent from the OpenJPA Users mailing list archive at Nabble.com.
>  > 
> 
> 
> 

-- 
View this message in context: http://n2.nabble.com/Removing-entity-with-Embedded-field-tp2354162p2384576.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Removing entity with Embedded field

Posted by Pinaki Poddar <pp...@apache.org>.
I had put a fix for this issue recently OPENJPA-935. 
Will the original reporter please verify?

OpenJPA makes a decision during bulk delete whether the delete operation
involves a single table only. That decision was not accounting for cascade
behavior for embedded fields. 

[1] http://issues.apache.org/jira/browse/OPENJPA-935



Jeremy Bauer wrote:
> 
> Hi Marcin,
> 
> I observe the same behavior when the base entity contains an embeddable.
> Without an embeddable, the provider issues a single delete (as expected).
> Since OpenJPA is operating on a single table, I don't see why multiple
> deletes are necessary.  Unless I'm missing something, this appears to be a
> bug in the provider.  Please open a JIRA.
> 
> -Jeremy
> 
> On Thu, Feb 19, 2009 at 6:37 AM, <ma...@poczta.onet.pl> wrote:
> 
>> Hi,
>>
>> I have a following beans:
>>
>> @Embeddable
>> class A {
>> int field1
>> }
>>
>> @Entity
>> class B {
>> @Id
>> long id;
>>
>> int field2
>>
>> @Embedded
>> A field3
>> }
>>
>> When I trying to delete all instances of B entity from data storage by
>> "delete from B" I got:
>>
>> 1. Query ("select" statement) for all B instances
>> 2. For each instance from 1. delete statement
>>
>> Why this is not delete by simple "delete from B" sql statement?
>>
>> Regards,
>> Marcin
>>
> 
> 

-- 
View this message in context: http://n2.nabble.com/Removing-entity-with-Embedded-field-tp2354162p2374113.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Removing entity with Embedded field

Posted by Jeremy Bauer <te...@gmail.com>.
Hi Marcin,

I observe the same behavior when the base entity contains an embeddable.
Without an embeddable, the provider issues a single delete (as expected).
Since OpenJPA is operating on a single table, I don't see why multiple
deletes are necessary.  Unless I'm missing something, this appears to be a
bug in the provider.  Please open a JIRA.

-Jeremy

On Thu, Feb 19, 2009 at 6:37 AM, <ma...@poczta.onet.pl> wrote:

> Hi,
>
> I have a following beans:
>
> @Embeddable
> class A {
> int field1
> }
>
> @Entity
> class B {
> @Id
> long id;
>
> int field2
>
> @Embedded
> A field3
> }
>
> When I trying to delete all instances of B entity from data storage by
> "delete from B" I got:
>
> 1. Query ("select" statement) for all B instances
> 2. For each instance from 1. delete statement
>
> Why this is not delete by simple "delete from B" sql statement?
>
> Regards,
> Marcin
>