You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Christian Defoy <ch...@gmail.com> on 2007/07/05 03:26:14 UTC

Re: Embedded entities are deleted last

Hi again!

This does make sense as I am trying to get the embedded classes to be
mapped in secondary tables.  Section 9.1.33 of the spec says that
implementors are not required to support embedded objects that are
mapped across multiple tables.  But that part seems to work just fine
with OpenJPA...

Here is what the schema looks like.  I created a simpler, totally
fake, schema for the purpose of the discussion but it is similar to
the one I have to use.

create table Shape
(
   shape_id IDENTITY not null primary key,
   type integer not null
);

create table Square
(
   shape_id integer not null primary key,
   x integer not null,
   y integer not null,
   side integer not null
);

create table Circle
(
   shape_id integer not null primary key,
   x integer not null,
   y integer not null,
   radius integer not null
);

alter table Circle add constraint f_circle_1 FOREIGN KEY (shape_id)
references shape(shape_id);
alter table Square add constraint f_square_1 FOREIGN KEY (shape_id)
references shape(shape_id);

I have three objects: Shape, Square and Circle.  Shape is the main
object and Square and Circle are marqued as being embeddables.  In
other words, Shape has one attribute of type Circle and one of type
Square.  I know that this is a typical case for hierarchy but I can't
change the object model and there is no hierarchy in it. :(  I defined
xml mappings for these objects.  They are pretty basic.  I am hesitant
to include them here since I have a feeling this mail will already be
quite long when I am done...

The first problem occurs when I try to persist a Shape containing a
Circle.  OpenJPA complains that there is no Circle_id column in the
circle table.  And that is correct.  However, the value that is saved
as circle_id is in fact shape_id because, as you said, an embedded
object does not have an identity of its own.  Since I did not define
this id (you can't define an id for an embeddable entity), I assume it
is a safeguard inside openjpa that says "If I have to persist
something in a table and I don't have an id for it, I will assume that
the column name is <class name> + "_id".

Assuming that I change my schema accordingly, renaming the two
shape_id columns to appropriate names, I am able to persist my shape
object correctly.  As I mentioned above, the value in the circle_id
column is that of the shape_id of my main table.

One last thing concerning the name of the id column in the Circle and
Square tables: I do not get the same name if I use annotations instead
of XML files.  Using xml files, I get <class name>_id and when I use
annotations I get <class name>_shape_id.  Also, when I use
annotations, an empty object gets serialized in the Square table when
no such object exists in memory.  That behavior does not appear when I
use xml files.

When I try to delete the Shape, I get a constraint violation because
the Shape itself is deleted before the entry in Circle.  But maybe
that is related to issueOPENJPA-235...  The sequence of SQL statements
I get is:

I first insert:
INSERT INTO SHAPE...
CALL IDENTITY()
INSERT INTO CIRCLE...
INSERT INTO SQUARE...

then I delete:
DELETE FROM SHAPE...
DELETE FROM CIRCLE...
DELETE FROM SQUARE...

when I commit my transaction, I get:
Integrity constraint violation F_CIRCLE_1 table: CIRCLE in statement
[DELETE FROM SHAPE...]} [code=-8, state=23000]

I tried defining secondary tables in the Shape object and specifying
them directly in the embeddable objects. The result is exactly the
same...

If you feel like having the code of the objects would be useful, just
tell me and I will post it.

Thanks again for your time!


Christian

Re: Embedded entities are deleted last

Posted by Christian Defoy <ch...@gmail.com>.
Hi Markus!

I moved my connection properties to the persistence.xml file but that
changed nothing.  However, I noticed you added a few properties :

  <property name="openjpa.FetchBatchSize" value="-1" />
  <property name="openjpa.Compatibility" value="StrictIdentityValues=true" />
  <property name="openjpa.Sequence" value="time" />
  <property name="openjpa.Log" value="SQL=TRACE" />
  <property name="openjpa.jdbc.DBDictionary"
value="StoreCharsAsNumbers=false" />
  <property name="openjpa.jdbc.SchemaFactory"
value="native(ForeignKeys=true)" />

The last one solves the problem.  I guess it forces OpenJPA to really
analyze the schema...

Thanks a lot for your time and effort!

Christian

On 7/9/07, Markus Fuchs <Ma...@sun.com> wrote:
> Hi Christian,
>
> I declared the connection properties in persistence.xml. That's the only
> difference from your setup. Could you try that?
>
> -- markus.
>
> Christian Defoy wrote:
> Hi Markus,
>
> I just tried with OpenJPA 1.0.0-snapshot.  I have the same problem.
> The log is attached to the mail...
>
> Christian
>
> On 7/9/07, Markus Fuchs <Ma...@sun.com> wrote:
> Hi Christian,
>
> everything gets deleted in proper order. Check the run log in the last
> attachment. Please try upgrading!
>
> -- markus.
>
> Christian Defoy wrote:
> > Hi Markus,
> >
> > I am using OpenJPA version 0.9.7.  If you think it could help, I will
> > try today with nightly build for 1.0.0.  I will also give it a try on
> > MSSQL as it is the other typ eof database we are using.
> >
> > When you said unable to reproduce, you mean that everything gets
> > deleted in the proper order? Embedded before main?
> >
> > Thanks!
> >
> > Christian
> >
> > On 7/6/07, Markus Fuchs <Ma...@sun.com> wrote:
> >> Hi Christian,
> >>
> >> I can not reproduce your problem. I ran against Derby, my test
> >> environment and output is attached. Are you using a current OpenJPA
> >> distribution?
> >>
> >> -- markus.
> >>
> >> Christian Defoy wrote:
> >> > Hi Markus,
> >> >
> >> > Here is the code to reproduce the problem.  I include the source code,
> >> > my persistence.xml file and the schema script for my database.  As I
> >> > mentionned in my first post, I am using Hypersonic (in case it is
> >> > important).
> >> >
> >> > Shape.java:
> >> > ----
> >> > import javax.persistence.*;
> >> >
> >> > @Entity
> >> > @Table(name="SHAPE")
> >> > @SecondaryTable(name="CIRCLE",
> >> >
> pkJoinColumns=@PrimaryKeyJoinColumn(name="shape_id",
> >> > referencedColumnName="shape_id"))
> >> > public class Shape
> >> > {
> >> >    @Column(name="shape_id")
> >> >    @Id
> >> >    @GeneratedValue(strategy=GenerationType.IDENTITY)
> >> >    private int id;
> >> >    private int type;
> >> >
> >> >    @Embedded
> >> >    @AttributeOverrides({
> >> >
> >> >
> @AttributeOverride(name="x",column=@Column(name="x",table="CIRCLE")),
> >> >
> >> >
> @AttributeOverride(name="y",column=@Column(name="y",table="CIRCLE")),
> >> >
> >> >
> >>
> @AttributeOverride(name="radius",column=@Column(name="radius",table="CIRCLE"))})
> >>
> >> >
> >> >    private Circle circle;
> >> >
> >> >    public int getId() { return id; }
> >> >    public void setType( int aType ) { type = aType; }
> >> >    public void setCircle( Circle anCircle ) { circle = anCircle; }
> >> > }
> >> >
> >> > Circle.java
> >> > ----
> >> > import javax.persistence.Embeddable;
> >> >
> >> > @Embeddable
> >> > public class Circle
> >> > {
> >> >    private int x;
> >> >    private int y;
> >> >    private int radius;
> >> >    public int getRadius() { return radius; }
> >> >    public void setRadius( int anRadius ) { radius = anRadius; }
> >> >    public int getX() { return x; }
> >> >    public void setX( int anX ) { x = anX; }
> >> >    public int getY() { return y;  }
> >> >    public void setY( int anY ) { y = anY; }
> >> > }
> >> >
> >> > ShapeHelper.java
> >> > ----
> >> > import java.util.HashMap;
> >> > import java.util.Map;
> >> >
> >> > import javax.persistence.*;
> >> >
> >> > public class ShapeHelper
> >> > {
> >> >    public static void main( String[] args ) throws Exception
> >> >    {
> >> >        Map<String,String> params = new HashMap<String,String>();
> >> >        params.put( "openjpa.Id", "basic" );
> >> >        params.put( "openjpa.ConnectionUserName", "sa" );
> >> >        params.put( "openjpa.ConnectionPassword", "" );
> >> >        params.put( "openjpa.ConnectionURL",
> >> > "jdbc:hsqldb:hsql://localhost/jpa-db" );
> >> >        params.put( "openjpa.ConnectionDriverName",
> >> > "org.hsqldb.jdbcDriver" );
> >> >
> >> >        EntityManagerFactory factory =
> >> > Persistence.createEntityManagerFactory( "basic",
> params );
> >> >
> >> >        EntityManager manager = factory.createEntityManager();
> >> >
> >> >        Shape base = new Shape();
> >> >        base.setType( 0 );
> >> >
> >> >        // Set embedded data in the shape
> >> >        Circle circle = new Circle();
> >> >        circle.setRadius( 10 );
> >> >        circle.setX( 100 );
> >> >        circle.setY( 50 );
> >> >        base.setCircle( circle );
> >> >
> >> >        EntityTransaction transaction = manager.getTransaction();
> >> >        transaction.begin();
> >> >        manager.persist( base );
> >> >        transaction.commit();
> >> >        manager.close();
> >> >
> >> >        // Load the thing
> >> >        manager = factory.createEntityManager();
> >> >        Shape loadedBase = manager.find( Shape.class, base.getId() );
> >> >
> >> >        transaction = manager.getTransaction();
> >> >        transaction.begin();
> >> >        manager.remove( loadedBase );
> >> >        transaction.commit();
> >> >        manager.close();
> >> >
> >> >
> >> >        // Clean up the factory
> >> >        factory.close();
> >> >    }
> >> > }
> >> >
> >> > persistence.xml:
> >> > ----
> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> > <persistence
> xmlns="http://java.sun.com/xml/ns/persistence"
> >> >
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >    version="1.0">
> >> >
> >> >    <persistence-unit name="basic"
> transaction-type="RESOURCE_LOCAL">
> >> >        <class>Shape</class>
> >> >        <class>Circle</class>
> >> >
> >> >         <properties>
> >> >             <property name="openjpa.Log" value="DefaultLevel=WARN,
> >> > Runtime=WARN, Tool=WARN, SQL=TRACE"/>
> >> >             <property name="openjpa.ConnectionRetainMode"
> >> > value="always"/>
> >> >         </properties>
> >> >    </persistence-unit>
> >> >
> >> >
> >> > </persistence>
> >> >
> >> > schema:
> >> > ----
> >> > DROP TABLE SHAPE IF EXISTS;
> >> > CREATE CACHED TABLE SHAPE
> >> > (
> >> >     SHAPE_ID IDENTITY NOT NULL PRIMARY KEY,
> >> >     TYPE INTEGER NOT NULL
> >> > );
> >> >
> >> > DROP TABLE CIRCLE IF EXISTS;
> >> > CREATE CACHED TABLE CIRCLE
> >> > (
> >> >     CIRCLE_SHAPE_ID INTEGER NOT NULL PRIMARY KEY,
> >> >     X INTEGER NOT NULL,
> >> >     Y INTEGER NOT NULL,
> >> >     RADIUS INTEGER NOT NULL
> >> > );
> >> >
> >> > ALTER TABLE CIRCLE ADD CONSTRAINT F_CIRCLE_1 FOREIGN KEY
> >> > (CIRCLE_SHAPE_ID) REFERENCES SHAPE(SHAPE_ID);
> >> >
> >> > Hope you'll be able to reproduce it :)
> >> >
> >> > Christian
> >>
> >>
>
> ________________________________
>
31 basic INFO [main] openjpa.Runtime - Starting OpenJPA 1.0.0-SNAPSHOT
94
> basic INFO [main] openjpa.jdbc.JDBC - Using dictionary class
> "org.apache.openjpa.jdbc.sql.HSQLDictionary".
750 basic
> TRACE [main] openjpa.jdbc.SQL - <t 9523050, conn 32820206> executing
> prepstmnt 2719739 INSERT INTO SHAPE (type) VALUES (?) [params=(int) 0]
750
> basic TRACE [main] openjpa.jdbc.SQL - <t 9523050, conn 32820206> [0 ms]
> spent
750 basic TRACE [main] openjpa.jdbc.SQL - <t 9523050, conn 32820206>
> executing prepstmnt 23414511 CALL IDENTITY()
750 basic TRACE [main]
> openjpa.jdbc.SQL - <t 9523050, conn 32820206> [0 ms] spent
750 basic TRACE
> [main] openjpa.jdbc.SQL - <t 9523050, conn 32820206> executing prepstmnt
> 22316618 INSERT INTO CIRCLE (Circle_shape_id, radius, x, y) VALUES (?, ?, ?,
> ?) [params=(int) 7, (int) 10, (int) 100, (int) 50]
750 basic TRACE [main]
> openjpa.jdbc.SQL - <t 9523050, conn 32820206> [0 ms] spent
797 basic TRACE
> [main] openjpa.jdbc.SQL - <t 9523050, conn 14372770> executing prepstmnt
> 1023040 SELECT t0.shape_id, t1.radius, t1.x, t1.y, t0.type FROM SHAPE t0
> INNER JOIN CIRCLE t1 ON t0.shape_id = t1.Circle_shape_id WHERE t0.shape_id =
> ? [params=(int) 7]
797 basic TRACE [main] openjpa.jdbc.SQL - <t 9523050,
> conn 14372770> [0 ms] spent
812 basic TRACE [main] openjpa.jdbc.SQL - <t
> 9523050, conn 14372770> executing prepstmnt 1309073 DELETE FROM SHAPE WHERE
> shape_id = ? [params=(int) 7]
812 basic TRACE [main] openjpa.jdbc.SQL - <t
> 9523050, conn 14372770> [0 ms] spent
812 basic TRACE [main] openjpa.jdbc.SQL
> - <t 9523050, conn 14372770> executing prepstmnt 18746387 DELETE FROM CIRCLE
> WHERE Circle_shape_id = ? [params=(int) 7]
812 basic TRACE [main]
> openjpa.jdbc.SQL - <t 9523050, conn 14372770> [0 ms] spent
Exception in
> thread "main" <1.0.0-SNAPSHOT-SNAPSHOT fatal store error>
> org.apache.openjpa.persistence.RollbackException: The
> transaction has been rolled back. See the nested exceptions for details on
> the errors that occurred.
 at
> org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:420)
> at ShapeHelper.main(ShapeHelper.java:46)
Caused by: <1.0.0-SNAPSHOT-SNAPSHOT
> fatal general error>
> org.apache.openjpa.persistence.PersistenceException: The
> transaction has been rolled back. See the nested exceptions for details on
> the errors that occurred.
 at
> org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2129)
> at
> org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1976)
> at
> org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1874)
> at
> org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1792)
> at
> org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:80)
> at
> org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1322)
> at
> org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:866)
> at
> org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:409)
> ... 1 more
Caused by: <1.0.0-SNAPSHOT-SNAPSHOT nonfatal general error>
> org.apache.openjpa.persistence.PersistenceException:
> Integrity constraint violation F_CIRCLE_1 table: CIRCLE in statement [DELETE
> FROM SHAPE WHERE shape_id = ?] {prepstmnt 1309073 DELETE FROM SHAPE WHERE
> shape_id = ? [params=(int) 7]} [code=-8, state=23000]
FailedObject: Shape-7
> at
> org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:3814)
> at
> org.apache.openjpa.jdbc.sql.HSQLDictionary.newStoreException(HSQLDictionary.java:308)
> at
> org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:97)
> at
> org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:67)
> at
> org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushInternal(PreparedStatementManagerImpl.java:106)
> at
> org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flush(PreparedStatementManagerImpl.java:71)
> at
> org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:416)
> at
> org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(ConstraintUpdateManager.java:117)
> at
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:89)
> at
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:72)
> at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:514)
> at
> org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:130)
> ... 8 more
Caused by:
> org.apache.openjpa.lib.jdbc.ReportingSQLException:
> Integrity constraint violation F_CIRCLE_1 table: CIRCLE in statement [DELETE
> FROM SHAPE WHERE shape_id = ?] {prepstmnt 1309073 DELETE FROM SHAPE WHERE
> shape_id = ? [params=(int) 7]} [code=-8, state=23000]
 at
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192)
> at
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$800(LoggingConnectionDecorator.java:57)
> at
> org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeUpdate(LoggingConnectionDecorator.java:858)
> at
> org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:269)
> at
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeUpdate(JDBCStoreManager.java:1363)
> at
> org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushInternal(PreparedStatementManagerImpl.java:95)
> ... 15 more

>

Re: Embedded entities are deleted last

Posted by Christian Defoy <ch...@gmail.com>.
Hi Markus,

I just tried with OpenJPA 1.0.0-snapshot.  I have the same problem.
The log is attached to the mail...

Christian

On 7/9/07, Markus Fuchs <Ma...@sun.com> wrote:
> Hi Christian,
>
> everything gets deleted in proper order. Check the run log in the last
> attachment. Please try upgrading!
>
> -- markus.
>
> Christian Defoy wrote:
> > Hi Markus,
> >
> > I am using OpenJPA version 0.9.7.  If you think it could help, I will
> > try today with nightly build for 1.0.0.  I will also give it a try on
> > MSSQL as it is the other typ eof database we are using.
> >
> > When you said unable to reproduce, you mean that everything gets
> > deleted in the proper order? Embedded before main?
> >
> > Thanks!
> >
> > Christian
> >
> > On 7/6/07, Markus Fuchs <Ma...@sun.com> wrote:
> >> Hi Christian,
> >>
> >> I can not reproduce your problem. I ran against Derby, my test
> >> environment and output is attached. Are you using a current OpenJPA
> >> distribution?
> >>
> >> -- markus.
> >>
> >> Christian Defoy wrote:
> >> > Hi Markus,
> >> >
> >> > Here is the code to reproduce the problem.  I include the source code,
> >> > my persistence.xml file and the schema script for my database.  As I
> >> > mentionned in my first post, I am using Hypersonic (in case it is
> >> > important).
> >> >
> >> > Shape.java:
> >> > ----
> >> > import javax.persistence.*;
> >> >
> >> > @Entity
> >> > @Table(name="SHAPE")
> >> > @SecondaryTable(name="CIRCLE",
> >> >                pkJoinColumns=@PrimaryKeyJoinColumn(name="shape_id",
> >> > referencedColumnName="shape_id"))
> >> > public class Shape
> >> > {
> >> >    @Column(name="shape_id")
> >> >    @Id
> >> >    @GeneratedValue(strategy=GenerationType.IDENTITY)
> >> >    private int id;
> >> >    private int type;
> >> >
> >> >    @Embedded
> >> >    @AttributeOverrides({
> >> >
> >> > @AttributeOverride(name="x",column=@Column(name="x",table="CIRCLE")),
> >> >
> >> > @AttributeOverride(name="y",column=@Column(name="y",table="CIRCLE")),
> >> >
> >> >
> >> @AttributeOverride(name="radius",column=@Column(name="radius",table="CIRCLE"))})
> >>
> >> >
> >> >    private Circle circle;
> >> >
> >> >    public int getId() { return id; }
> >> >    public void setType( int aType ) { type = aType; }
> >> >    public void setCircle( Circle anCircle ) { circle = anCircle; }
> >> > }
> >> >
> >> > Circle.java
> >> > ----
> >> > import javax.persistence.Embeddable;
> >> >
> >> > @Embeddable
> >> > public class Circle
> >> > {
> >> >    private int x;
> >> >    private int y;
> >> >    private int radius;
> >> >    public int getRadius() { return radius; }
> >> >    public void setRadius( int anRadius ) { radius = anRadius; }
> >> >    public int getX() { return x; }
> >> >    public void setX( int anX ) { x = anX; }
> >> >    public int getY() { return y;  }
> >> >    public void setY( int anY ) { y = anY; }
> >> > }
> >> >
> >> > ShapeHelper.java
> >> > ----
> >> > import java.util.HashMap;
> >> > import java.util.Map;
> >> >
> >> > import javax.persistence.*;
> >> >
> >> > public class ShapeHelper
> >> > {
> >> >    public static void main( String[] args ) throws Exception
> >> >    {
> >> >        Map<String,String> params = new HashMap<String,String>();
> >> >        params.put( "openjpa.Id", "basic" );
> >> >        params.put( "openjpa.ConnectionUserName", "sa" );
> >> >        params.put( "openjpa.ConnectionPassword", "" );
> >> >        params.put( "openjpa.ConnectionURL",
> >> > "jdbc:hsqldb:hsql://localhost/jpa-db" );
> >> >        params.put( "openjpa.ConnectionDriverName",
> >> > "org.hsqldb.jdbcDriver" );
> >> >
> >> >        EntityManagerFactory factory =
> >> > Persistence.createEntityManagerFactory( "basic", params );
> >> >
> >> >        EntityManager manager = factory.createEntityManager();
> >> >
> >> >        Shape base = new Shape();
> >> >        base.setType( 0 );
> >> >
> >> >        // Set embedded data in the shape
> >> >        Circle circle = new Circle();
> >> >        circle.setRadius( 10 );
> >> >        circle.setX( 100 );
> >> >        circle.setY( 50 );
> >> >        base.setCircle( circle );
> >> >
> >> >        EntityTransaction transaction = manager.getTransaction();
> >> >        transaction.begin();
> >> >        manager.persist( base );
> >> >        transaction.commit();
> >> >        manager.close();
> >> >
> >> >        // Load the thing
> >> >        manager = factory.createEntityManager();
> >> >        Shape loadedBase = manager.find( Shape.class, base.getId() );
> >> >
> >> >        transaction = manager.getTransaction();
> >> >        transaction.begin();
> >> >        manager.remove( loadedBase );
> >> >        transaction.commit();
> >> >        manager.close();
> >> >
> >> >
> >> >        // Clean up the factory
> >> >        factory.close();
> >> >    }
> >> > }
> >> >
> >> > persistence.xml:
> >> > ----
> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> > <persistence xmlns="http://java.sun.com/xml/ns/persistence"
> >> >    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >    version="1.0">
> >> >
> >> >    <persistence-unit name="basic" transaction-type="RESOURCE_LOCAL">
> >> >        <class>Shape</class>
> >> >        <class>Circle</class>
> >> >
> >> >         <properties>
> >> >             <property name="openjpa.Log" value="DefaultLevel=WARN,
> >> > Runtime=WARN, Tool=WARN, SQL=TRACE"/>
> >> >             <property name="openjpa.ConnectionRetainMode"
> >> > value="always"/>
> >> >         </properties>
> >> >    </persistence-unit>
> >> >
> >> >
> >> > </persistence>
> >> >
> >> > schema:
> >> > ----
> >> > DROP TABLE SHAPE IF EXISTS;
> >> > CREATE CACHED TABLE SHAPE
> >> > (
> >> >     SHAPE_ID IDENTITY NOT NULL PRIMARY KEY,
> >> >     TYPE INTEGER NOT NULL
> >> > );
> >> >
> >> > DROP TABLE CIRCLE IF EXISTS;
> >> > CREATE CACHED TABLE CIRCLE
> >> > (
> >> >     CIRCLE_SHAPE_ID INTEGER NOT NULL PRIMARY KEY,
> >> >     X INTEGER NOT NULL,
> >> >     Y INTEGER NOT NULL,
> >> >     RADIUS INTEGER NOT NULL
> >> > );
> >> >
> >> > ALTER TABLE CIRCLE ADD CONSTRAINT F_CIRCLE_1 FOREIGN KEY
> >> > (CIRCLE_SHAPE_ID) REFERENCES SHAPE(SHAPE_ID);
> >> >
> >> > Hope you'll be able to reproduce it :)
> >> >
> >> > Christian
> >>
> >>
>

Re: Embedded entities are deleted last

Posted by Markus Fuchs <Ma...@Sun.COM>.
Hi Christian,

everything gets deleted in proper order. Check the run log in the last 
attachment. Please try upgrading!

-- markus.

Christian Defoy wrote:
> Hi Markus,
>
> I am using OpenJPA version 0.9.7.  If you think it could help, I will
> try today with nightly build for 1.0.0.  I will also give it a try on
> MSSQL as it is the other typ eof database we are using.
>
> When you said unable to reproduce, you mean that everything gets
> deleted in the proper order? Embedded before main?
>
> Thanks!
>
> Christian
>
> On 7/6/07, Markus Fuchs <Ma...@sun.com> wrote:
>> Hi Christian,
>>
>> I can not reproduce your problem. I ran against Derby, my test
>> environment and output is attached. Are you using a current OpenJPA
>> distribution?
>>
>> -- markus.
>>
>> Christian Defoy wrote:
>> > Hi Markus,
>> >
>> > Here is the code to reproduce the problem.  I include the source code,
>> > my persistence.xml file and the schema script for my database.  As I
>> > mentionned in my first post, I am using Hypersonic (in case it is
>> > important).
>> >
>> > Shape.java:
>> > ----
>> > import javax.persistence.*;
>> >
>> > @Entity
>> > @Table(name="SHAPE")
>> > @SecondaryTable(name="CIRCLE",
>> >                pkJoinColumns=@PrimaryKeyJoinColumn(name="shape_id",
>> > referencedColumnName="shape_id"))
>> > public class Shape
>> > {
>> >    @Column(name="shape_id")
>> >    @Id
>> >    @GeneratedValue(strategy=GenerationType.IDENTITY)
>> >    private int id;
>> >    private int type;
>> >
>> >    @Embedded
>> >    @AttributeOverrides({
>> >
>> > @AttributeOverride(name="x",column=@Column(name="x",table="CIRCLE")),
>> >
>> > @AttributeOverride(name="y",column=@Column(name="y",table="CIRCLE")),
>> >
>> > 
>> @AttributeOverride(name="radius",column=@Column(name="radius",table="CIRCLE"))}) 
>>
>> >
>> >    private Circle circle;
>> >
>> >    public int getId() { return id; }
>> >    public void setType( int aType ) { type = aType; }
>> >    public void setCircle( Circle anCircle ) { circle = anCircle; }
>> > }
>> >
>> > Circle.java
>> > ----
>> > import javax.persistence.Embeddable;
>> >
>> > @Embeddable
>> > public class Circle
>> > {
>> >    private int x;
>> >    private int y;
>> >    private int radius;
>> >    public int getRadius() { return radius; }
>> >    public void setRadius( int anRadius ) { radius = anRadius; }
>> >    public int getX() { return x; }
>> >    public void setX( int anX ) { x = anX; }
>> >    public int getY() { return y;  }
>> >    public void setY( int anY ) { y = anY; }
>> > }
>> >
>> > ShapeHelper.java
>> > ----
>> > import java.util.HashMap;
>> > import java.util.Map;
>> >
>> > import javax.persistence.*;
>> >
>> > public class ShapeHelper
>> > {
>> >    public static void main( String[] args ) throws Exception
>> >    {
>> >        Map<String,String> params = new HashMap<String,String>();
>> >        params.put( "openjpa.Id", "basic" );
>> >        params.put( "openjpa.ConnectionUserName", "sa" );
>> >        params.put( "openjpa.ConnectionPassword", "" );
>> >        params.put( "openjpa.ConnectionURL",
>> > "jdbc:hsqldb:hsql://localhost/jpa-db" );
>> >        params.put( "openjpa.ConnectionDriverName",
>> > "org.hsqldb.jdbcDriver" );
>> >
>> >        EntityManagerFactory factory =
>> > Persistence.createEntityManagerFactory( "basic", params );
>> >
>> >        EntityManager manager = factory.createEntityManager();
>> >
>> >        Shape base = new Shape();
>> >        base.setType( 0 );
>> >
>> >        // Set embedded data in the shape
>> >        Circle circle = new Circle();
>> >        circle.setRadius( 10 );
>> >        circle.setX( 100 );
>> >        circle.setY( 50 );
>> >        base.setCircle( circle );
>> >
>> >        EntityTransaction transaction = manager.getTransaction();
>> >        transaction.begin();
>> >        manager.persist( base );
>> >        transaction.commit();
>> >        manager.close();
>> >
>> >        // Load the thing
>> >        manager = factory.createEntityManager();
>> >        Shape loadedBase = manager.find( Shape.class, base.getId() );
>> >
>> >        transaction = manager.getTransaction();
>> >        transaction.begin();
>> >        manager.remove( loadedBase );
>> >        transaction.commit();
>> >        manager.close();
>> >
>> >
>> >        // Clean up the factory
>> >        factory.close();
>> >    }
>> > }
>> >
>> > persistence.xml:
>> > ----
>> > <?xml version="1.0" encoding="UTF-8"?>
>> > <persistence xmlns="http://java.sun.com/xml/ns/persistence"
>> >    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> >    version="1.0">
>> >
>> >    <persistence-unit name="basic" transaction-type="RESOURCE_LOCAL">
>> >        <class>Shape</class>
>> >        <class>Circle</class>
>> >
>> >         <properties>
>> >             <property name="openjpa.Log" value="DefaultLevel=WARN,
>> > Runtime=WARN, Tool=WARN, SQL=TRACE"/>
>> >             <property name="openjpa.ConnectionRetainMode"
>> > value="always"/>
>> >         </properties>
>> >    </persistence-unit>
>> >
>> >
>> > </persistence>
>> >
>> > schema:
>> > ----
>> > DROP TABLE SHAPE IF EXISTS;
>> > CREATE CACHED TABLE SHAPE
>> > (
>> >     SHAPE_ID IDENTITY NOT NULL PRIMARY KEY,
>> >     TYPE INTEGER NOT NULL
>> > );
>> >
>> > DROP TABLE CIRCLE IF EXISTS;
>> > CREATE CACHED TABLE CIRCLE
>> > (
>> >     CIRCLE_SHAPE_ID INTEGER NOT NULL PRIMARY KEY,
>> >     X INTEGER NOT NULL,
>> >     Y INTEGER NOT NULL,
>> >     RADIUS INTEGER NOT NULL
>> > );
>> >
>> > ALTER TABLE CIRCLE ADD CONSTRAINT F_CIRCLE_1 FOREIGN KEY
>> > (CIRCLE_SHAPE_ID) REFERENCES SHAPE(SHAPE_ID);
>> >
>> > Hope you'll be able to reproduce it :)
>> >
>> > Christian
>>
>>

Re: Embedded entities are deleted last

Posted by Christian Defoy <ch...@gmail.com>.
Hi Markus,

I am using OpenJPA version 0.9.7.  If you think it could help, I will
try today with nightly build for 1.0.0.  I will also give it a try on
MSSQL as it is the other typ eof database we are using.

When you said unable to reproduce, you mean that everything gets
deleted in the proper order? Embedded before main?

Thanks!

Christian

On 7/6/07, Markus Fuchs <Ma...@sun.com> wrote:
> Hi Christian,
>
> I can not reproduce your problem. I ran against Derby, my test
> environment and output is attached. Are you using a current OpenJPA
> distribution?
>
> -- markus.
>
> Christian Defoy wrote:
> > Hi Markus,
> >
> > Here is the code to reproduce the problem.  I include the source code,
> > my persistence.xml file and the schema script for my database.  As I
> > mentionned in my first post, I am using Hypersonic (in case it is
> > important).
> >
> > Shape.java:
> > ----
> > import javax.persistence.*;
> >
> > @Entity
> > @Table(name="SHAPE")
> > @SecondaryTable(name="CIRCLE",
> >                pkJoinColumns=@PrimaryKeyJoinColumn(name="shape_id",
> > referencedColumnName="shape_id"))
> > public class Shape
> > {
> >    @Column(name="shape_id")
> >    @Id
> >    @GeneratedValue(strategy=GenerationType.IDENTITY)
> >    private int id;
> >    private int type;
> >
> >    @Embedded
> >    @AttributeOverrides({
> >
> > @AttributeOverride(name="x",column=@Column(name="x",table="CIRCLE")),
> >
> > @AttributeOverride(name="y",column=@Column(name="y",table="CIRCLE")),
> >
> > @AttributeOverride(name="radius",column=@Column(name="radius",table="CIRCLE"))})
> >
> >    private Circle circle;
> >
> >    public int getId() { return id; }
> >    public void setType( int aType ) { type = aType; }
> >    public void setCircle( Circle anCircle ) { circle = anCircle; }
> > }
> >
> > Circle.java
> > ----
> > import javax.persistence.Embeddable;
> >
> > @Embeddable
> > public class Circle
> > {
> >    private int x;
> >    private int y;
> >    private int radius;
> >    public int getRadius() { return radius; }
> >    public void setRadius( int anRadius ) { radius = anRadius; }
> >    public int getX() { return x; }
> >    public void setX( int anX ) { x = anX; }
> >    public int getY() { return y;  }
> >    public void setY( int anY ) { y = anY; }
> > }
> >
> > ShapeHelper.java
> > ----
> > import java.util.HashMap;
> > import java.util.Map;
> >
> > import javax.persistence.*;
> >
> > public class ShapeHelper
> > {
> >    public static void main( String[] args ) throws Exception
> >    {
> >        Map<String,String> params = new HashMap<String,String>();
> >        params.put( "openjpa.Id", "basic" );
> >        params.put( "openjpa.ConnectionUserName", "sa" );
> >        params.put( "openjpa.ConnectionPassword", "" );
> >        params.put( "openjpa.ConnectionURL",
> > "jdbc:hsqldb:hsql://localhost/jpa-db" );
> >        params.put( "openjpa.ConnectionDriverName",
> > "org.hsqldb.jdbcDriver" );
> >
> >        EntityManagerFactory factory =
> > Persistence.createEntityManagerFactory( "basic", params );
> >
> >        EntityManager manager = factory.createEntityManager();
> >
> >        Shape base = new Shape();
> >        base.setType( 0 );
> >
> >        // Set embedded data in the shape
> >        Circle circle = new Circle();
> >        circle.setRadius( 10 );
> >        circle.setX( 100 );
> >        circle.setY( 50 );
> >        base.setCircle( circle );
> >
> >        EntityTransaction transaction = manager.getTransaction();
> >        transaction.begin();
> >        manager.persist( base );
> >        transaction.commit();
> >        manager.close();
> >
> >        // Load the thing
> >        manager = factory.createEntityManager();
> >        Shape loadedBase = manager.find( Shape.class, base.getId() );
> >
> >        transaction = manager.getTransaction();
> >        transaction.begin();
> >        manager.remove( loadedBase );
> >        transaction.commit();
> >        manager.close();
> >
> >
> >        // Clean up the factory
> >        factory.close();
> >    }
> > }
> >
> > persistence.xml:
> > ----
> > <?xml version="1.0" encoding="UTF-8"?>
> > <persistence xmlns="http://java.sun.com/xml/ns/persistence"
> >    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >    version="1.0">
> >
> >    <persistence-unit name="basic" transaction-type="RESOURCE_LOCAL">
> >        <class>Shape</class>
> >        <class>Circle</class>
> >
> >         <properties>
> >             <property name="openjpa.Log" value="DefaultLevel=WARN,
> > Runtime=WARN, Tool=WARN, SQL=TRACE"/>
> >             <property name="openjpa.ConnectionRetainMode"
> > value="always"/>
> >         </properties>
> >    </persistence-unit>
> >
> >
> > </persistence>
> >
> > schema:
> > ----
> > DROP TABLE SHAPE IF EXISTS;
> > CREATE CACHED TABLE SHAPE
> > (
> >     SHAPE_ID IDENTITY NOT NULL PRIMARY KEY,
> >     TYPE INTEGER NOT NULL
> > );
> >
> > DROP TABLE CIRCLE IF EXISTS;
> > CREATE CACHED TABLE CIRCLE
> > (
> >     CIRCLE_SHAPE_ID INTEGER NOT NULL PRIMARY KEY,
> >     X INTEGER NOT NULL,
> >     Y INTEGER NOT NULL,
> >     RADIUS INTEGER NOT NULL
> > );
> >
> > ALTER TABLE CIRCLE ADD CONSTRAINT F_CIRCLE_1 FOREIGN KEY
> > (CIRCLE_SHAPE_ID) REFERENCES SHAPE(SHAPE_ID);
> >
> > Hope you'll be able to reproduce it :)
> >
> > Christian
>
>

Re: Embedded entities are deleted last

Posted by Markus Fuchs <Ma...@Sun.COM>.
Hi Christian,

I can not reproduce your problem. I ran against Derby, my test 
environment and output is attached. Are you using a current OpenJPA 
distribution?

-- markus.

Christian Defoy wrote:
> Hi Markus,
>
> Here is the code to reproduce the problem.  I include the source code,
> my persistence.xml file and the schema script for my database.  As I
> mentionned in my first post, I am using Hypersonic (in case it is
> important).
>
> Shape.java:
> ----
> import javax.persistence.*;
>
> @Entity
> @Table(name="SHAPE")
> @SecondaryTable(name="CIRCLE",
>                pkJoinColumns=@PrimaryKeyJoinColumn(name="shape_id",
> referencedColumnName="shape_id"))
> public class Shape
> {
>    @Column(name="shape_id")
>    @Id
>    @GeneratedValue(strategy=GenerationType.IDENTITY)
>    private int id;
>    private int type;
>
>    @Embedded
>    @AttributeOverrides({
>        
> @AttributeOverride(name="x",column=@Column(name="x",table="CIRCLE")),
>        
> @AttributeOverride(name="y",column=@Column(name="y",table="CIRCLE")),
>        
> @AttributeOverride(name="radius",column=@Column(name="radius",table="CIRCLE"))}) 
>
>    private Circle circle;
>
>    public int getId() { return id; }
>    public void setType( int aType ) { type = aType; }
>    public void setCircle( Circle anCircle ) { circle = anCircle; }
> }
>
> Circle.java
> ----
> import javax.persistence.Embeddable;
>
> @Embeddable
> public class Circle
> {
>    private int x;
>    private int y;
>    private int radius;
>    public int getRadius() { return radius; }
>    public void setRadius( int anRadius ) { radius = anRadius; }
>    public int getX() { return x; }
>    public void setX( int anX ) { x = anX; }
>    public int getY() { return y;  }
>    public void setY( int anY ) { y = anY; }
> }
>
> ShapeHelper.java
> ----
> import java.util.HashMap;
> import java.util.Map;
>
> import javax.persistence.*;
>
> public class ShapeHelper
> {
>    public static void main( String[] args ) throws Exception
>    {
>        Map<String,String> params = new HashMap<String,String>();
>        params.put( "openjpa.Id", "basic" );
>        params.put( "openjpa.ConnectionUserName", "sa" );
>        params.put( "openjpa.ConnectionPassword", "" );
>        params.put( "openjpa.ConnectionURL",
> "jdbc:hsqldb:hsql://localhost/jpa-db" );
>        params.put( "openjpa.ConnectionDriverName", 
> "org.hsqldb.jdbcDriver" );
>
>        EntityManagerFactory factory =
> Persistence.createEntityManagerFactory( "basic", params );
>
>        EntityManager manager = factory.createEntityManager();
>
>        Shape base = new Shape();
>        base.setType( 0 );
>
>        // Set embedded data in the shape
>        Circle circle = new Circle();
>        circle.setRadius( 10 );
>        circle.setX( 100 );
>        circle.setY( 50 );
>        base.setCircle( circle );
>
>        EntityTransaction transaction = manager.getTransaction();
>        transaction.begin();
>        manager.persist( base );
>        transaction.commit();
>        manager.close();
>
>        // Load the thing
>        manager = factory.createEntityManager();
>        Shape loadedBase = manager.find( Shape.class, base.getId() );
>
>        transaction = manager.getTransaction();
>        transaction.begin();
>        manager.remove( loadedBase );
>        transaction.commit();
>        manager.close();
>
>
>        // Clean up the factory
>        factory.close();
>    }
> }
>
> persistence.xml:
> ----
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>    version="1.0">
>
>    <persistence-unit name="basic" transaction-type="RESOURCE_LOCAL">
>        <class>Shape</class>
>        <class>Circle</class>
>
>         <properties>
>             <property name="openjpa.Log" value="DefaultLevel=WARN,
> Runtime=WARN, Tool=WARN, SQL=TRACE"/>
>             <property name="openjpa.ConnectionRetainMode" 
> value="always"/>
>         </properties>
>    </persistence-unit>
>
>
> </persistence>
>
> schema:
> ----
> DROP TABLE SHAPE IF EXISTS;
> CREATE CACHED TABLE SHAPE
> (
>     SHAPE_ID IDENTITY NOT NULL PRIMARY KEY,
>     TYPE INTEGER NOT NULL
> );
>
> DROP TABLE CIRCLE IF EXISTS;
> CREATE CACHED TABLE CIRCLE
> (
>     CIRCLE_SHAPE_ID INTEGER NOT NULL PRIMARY KEY,
>     X INTEGER NOT NULL,
>     Y INTEGER NOT NULL,
>     RADIUS INTEGER NOT NULL
> );
>
> ALTER TABLE CIRCLE ADD CONSTRAINT F_CIRCLE_1 FOREIGN KEY
> (CIRCLE_SHAPE_ID) REFERENCES SHAPE(SHAPE_ID);
>
> Hope you'll be able to reproduce it :)
>
> Christian

Re: Embedded entities are deleted last

Posted by Christian Defoy <ch...@gmail.com>.
Hi Markus,

Here is the code to reproduce the problem.  I include the source code,
my persistence.xml file and the schema script for my database.  As I
mentionned in my first post, I am using Hypersonic (in case it is
important).

Shape.java:
----
import javax.persistence.*;

@Entity
@Table(name="SHAPE")
@SecondaryTable(name="CIRCLE",
                pkJoinColumns=@PrimaryKeyJoinColumn(name="shape_id",
referencedColumnName="shape_id"))
public class Shape
{
    @Column(name="shape_id")
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private int id;
    private int type;

    @Embedded
    @AttributeOverrides({
        @AttributeOverride(name="x",column=@Column(name="x",table="CIRCLE")),
        @AttributeOverride(name="y",column=@Column(name="y",table="CIRCLE")),
        @AttributeOverride(name="radius",column=@Column(name="radius",table="CIRCLE"))})
    private Circle circle;

    public int getId() { return id; }
    public void setType( int aType ) { type = aType; }
    public void setCircle( Circle anCircle ) { circle = anCircle; }
}

Circle.java
----
import javax.persistence.Embeddable;

@Embeddable
public class Circle
{
    private int x;
    private int y;
    private int radius;
    public int getRadius() { return radius; }
    public void setRadius( int anRadius ) { radius = anRadius; }
    public int getX() { return x; }
    public void setX( int anX ) { x = anX; }
    public int getY() { return y;  }
    public void setY( int anY ) { y = anY; }
}

ShapeHelper.java
----
import java.util.HashMap;
import java.util.Map;

import javax.persistence.*;

public class ShapeHelper
{
    public static void main( String[] args ) throws Exception
    {
        Map<String,String> params = new HashMap<String,String>();
        params.put( "openjpa.Id", "basic" );
        params.put( "openjpa.ConnectionUserName", "sa" );
        params.put( "openjpa.ConnectionPassword", "" );
        params.put( "openjpa.ConnectionURL",
"jdbc:hsqldb:hsql://localhost/jpa-db" );
        params.put( "openjpa.ConnectionDriverName", "org.hsqldb.jdbcDriver" );

        EntityManagerFactory factory =
Persistence.createEntityManagerFactory( "basic", params );

        EntityManager manager = factory.createEntityManager();

        Shape base = new Shape();
        base.setType( 0 );

        // Set embedded data in the shape
        Circle circle = new Circle();
        circle.setRadius( 10 );
        circle.setX( 100 );
        circle.setY( 50 );
        base.setCircle( circle );

        EntityTransaction transaction = manager.getTransaction();
        transaction.begin();
        manager.persist( base );
        transaction.commit();
        manager.close();

        // Load the thing
        manager = factory.createEntityManager();
        Shape loadedBase = manager.find( Shape.class, base.getId() );

        transaction = manager.getTransaction();
        transaction.begin();
        manager.remove( loadedBase );
        transaction.commit();
        manager.close();


        // Clean up the factory
        factory.close();
    }
}

persistence.xml:
----
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="1.0">

    <persistence-unit name="basic" transaction-type="RESOURCE_LOCAL">
    	<class>Shape</class>
    	<class>Circle</class>

	    <properties>
		    <property name="openjpa.Log" value="DefaultLevel=WARN,
Runtime=WARN, Tool=WARN, SQL=TRACE"/>
		    <property name="openjpa.ConnectionRetainMode" value="always"/>
		</properties>
    </persistence-unit>


</persistence>

schema:
----
DROP TABLE SHAPE IF EXISTS;
CREATE CACHED TABLE SHAPE
(
	SHAPE_ID IDENTITY NOT NULL PRIMARY KEY,
	TYPE INTEGER NOT NULL
);

DROP TABLE CIRCLE IF EXISTS;
CREATE CACHED TABLE CIRCLE
(
	CIRCLE_SHAPE_ID INTEGER NOT NULL PRIMARY KEY,
	X INTEGER NOT NULL,
	Y INTEGER NOT NULL,
	RADIUS INTEGER NOT NULL
);

ALTER TABLE CIRCLE ADD CONSTRAINT F_CIRCLE_1 FOREIGN KEY
(CIRCLE_SHAPE_ID) REFERENCES SHAPE(SHAPE_ID);

Hope you'll be able to reproduce it :)

Christian

Re: Embedded entities are deleted last

Posted by Markus Fuchs <Ma...@Sun.COM>.
Hi Christian,

> When I try to delete the Shape, I get a constraint violation because
> the Shape itself is deleted before the entry in Circle.  But maybe
> that is related to issueOPENJPA-235...  
This problem is not related to OPENJPA-235. Foreign key constraints 
between secondary and primary tables are handled differently from 
foreign key constraints that exist because of relationships. Both 
classes implementing flush behavior in OpenJPA 
(OperationOrderUpdateManager and ConstraintUpdateManager) execute 
deletes from secondary tables *before* any operations on primary tables. 
Could you provide a simple test case to reproduce the error?

Thanks,

-- markus.
> The sequence of SQL statements
> I get is:
>
> I first insert:
> INSERT INTO SHAPE...
> CALL IDENTITY()
> INSERT INTO CIRCLE...
> INSERT INTO SQUARE...
>
> then I delete:
> DELETE FROM SHAPE...
> DELETE FROM CIRCLE...
> DELETE FROM SQUARE...
>
> when I commit my transaction, I get:
> Integrity constraint violation F_CIRCLE_1 table: CIRCLE in statement
> [DELETE FROM SHAPE...]} [code=-8, state=23000]
>
> I tried defining secondary tables in the Shape object and specifying
> them directly in the embeddable objects. The result is exactly the
> same...
>
> If you feel like having the code of the objects would be useful, just
> tell me and I will post it.
>
> Thanks again for your time!
>
>
> Christian