You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Peter Karich <pe...@yahoo.de> on 2006/12/14 14:49:34 UTC

Incorrect Insert-Statement Order After Deleting All Objects

Hallo,

After creating the database schema I can successfully insert objects.
But if I will do the schema creation (DbGenerator.runGenerator) after I 
already have some objects in the database (so the user can change the 
mapping!) I will get an error [1], the mapping is in [2].
To avoid possible caching I deleted all the database, before I overwrite 
the schema like:

Collection rooms = getAllRooms();
getContext().deleteObjects(rooms);
getContext().commitChanges();

Collection tis = getAllTimeIntervals();
getContext().deleteObjects(tis);
getContext().commitChanges();

Collection subjects = getAllSubjects();
getContext().deleteObjects(subjects);
getContext().getEntityResolver().clearCache();
getContext().getObjectStore().getDataRowCache().clear();
getContext().commitChanges();

The problem is (I think) that cayenne think there is a Subject with ID = 
349. But there is no subject with this ID! It WAS removed from the 
database with the schemacreation and with the deleteObjects to make it 
secure...
Maybe cayenne calculated an incorrect order of the statements, because 
sometimes it works sometimes not?
What is wrong?
What else should I remove?
I use Cayenne 1.2.1 and derby 10.2.1.1


Thank you in advance, Peter Karich.





[1] INFO  QueryLogger: INSERT INTO TIMEINTERVAL (DURATION_TIME, ROOM_FK, 
START_TIME, SUBJECT_FK, TIMEINTERVAL_ID) VALUES (?, ?, ?, ?, ?)
INFO  QueryLogger: [bind: 30, 236, 427, 349, 200]
INFO  QueryLogger: *** error.
java.sql.SQLException: INSERT on table 'TIMEINTERVAL' caused a violation 
of foreign key constraint 'SQL061214022418000' for key (349).  The 
statement has been rolled back.
         at 
org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown 
Source)
         at 
org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
         at 
org.apache.derby.client.am.PreparedStatement.executeUpdate(Unknown Source)
         at 
org.objectstyle.cayenne.access.jdbc.BatchAction.runAsIndividualQueries(BatchAction.java:224)
         at 
org.objectstyle.cayenne.access.jdbc.BatchAction.performAction(BatchAction.java:117)
         at 
org.objectstyle.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:95)
         at 
org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:309)
         at 
org.objectstyle.cayenne.access.DataDomainFlushAction.runQueries(DataDomainFlushAction.java:255)
         at 
org.objectstyle.cayenne.access.DataDomainFlushAction.flush(DataDomainFlushAction.java:177)
         at 
org.objectstyle.cayenne.access.DataDomain.onSyncFlush(DataDomain.java:830)
         at 
org.objectstyle.cayenne.access.DataDomain$2.transform(DataDomain.java:801)
         at 
org.objectstyle.cayenne.access.DataDomain.runInTransaction(DataDomain.java:856)
         at 
org.objectstyle.cayenne.access.DataDomain.onSync(DataDomain.java:798)
         at 
org.objectstyle.cayenne.access.DataContext.flushToParent(DataContext.java:1261)
         at 
org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:1165)


[2] <?xml version="1.0" encoding="utf-8"?>
<data-map project-version="1.1">
	<property name="defaultLockType" value="optimistic"/>
	<property name="defaultPackage" value="de.gstpl.data"/>
	<property name="defaultSuperclass" value="Timetable"/>
	<property name="clientSupported" value="true"/>
	<db-entity name="DB_PROPERTIES">
		<db-attribute name="DATA_MAP" type="LONGVARCHAR" isMandatory="true"/>
		<db-attribute name="DAY_DURATION" type="INTEGER" isMandatory="true"/>
		<db-attribute name="DAY_NO" type="INTEGER" isMandatory="true"/>
		<db-attribute name="DAY_START" type="INTEGER" isMandatory="true"/>
		<db-attribute name="DB_PROPERTIES_ID" type="INTEGER" 
isPrimaryKey="true" isMandatory="true"/>
		<db-attribute name="DEFAULT_ROOM_CAPACITY" type="INTEGER" 
isMandatory="true"/>
		<db-attribute name="LAST_MAP_UPDATE" type="DATE" isMandatory="true"/>
		<db-attribute name="MIN_TIME_INTERVAL" type="INTEGER" isMandatory="true"/>
		<db-attribute name="USEFUL_TIME_INTERVAL" type="INTEGER" 
isMandatory="true"/>
		<db-attribute name="VERSION" type="VARCHAR" isMandatory="true" 
length="10"/>
	</db-entity>
	<db-entity name="GROUPY">
		<db-attribute name="GROUPY_ID" type="INTEGER" isPrimaryKey="true" 
isMandatory="true"/>
		<db-attribute name="NAME" type="VARCHAR" isMandatory="true" length="50"/>
	</db-entity>
	<db-entity name="PERSON">
		<db-attribute name="LOGIN" type="VARCHAR" length="50"/>
		<db-attribute name="NAME" type="VARCHAR" isMandatory="true" length="50"/>
		<db-attribute name="PERSON_ID" type="INTEGER" isPrimaryKey="true" 
isMandatory="true"/>
	</db-entity>
	<db-entity name="PERSON_SUBJECT">
		<db-attribute name="PERSON_FK" type="INTEGER" isMandatory="true"/>
		<db-attribute name="PERSON_SUBJECT_ID" type="INTEGER" 
isPrimaryKey="true" isMandatory="true"/>
		<db-attribute name="SUBJECT_FK" type="INTEGER" isMandatory="true"/>
	</db-entity>
	<db-entity name="ROOM">
		<db-attribute name="CAPACITY" type="INTEGER"/>
		<db-attribute name="DESCRIPTION" type="VARCHAR" length="512"/>
		<db-attribute name="DISTANCE" type="INTEGER"/>
		<db-attribute name="KIND_U" type="VARCHAR" length="15"/>
		<db-attribute name="LOCATION_U" type="VARCHAR" length="15"/>
		<db-attribute name="NAME" type="VARCHAR" isMandatory="true" length="50"/>
		<db-attribute name="ROOM_ID" type="INTEGER" isPrimaryKey="true" 
isMandatory="true"/>
	</db-entity>
	<db-entity name="SUBJECT">
		<db-attribute name="DESCRIPTION" type="VARCHAR" length="512"/>
		<db-attribute name="NAME" type="VARCHAR" isMandatory="true" length="50"/>
		<db-attribute name="SEMESTER_U" type="INTEGER"/>
		<db-attribute name="SUBJECT_ID" type="INTEGER" isPrimaryKey="true" 
isMandatory="true"/>
	</db-entity>
	<db-entity name="TIMEINTERVAL">
		<db-attribute name="DURATION_TIME" type="INTEGER" isMandatory="true"/>
		<db-attribute name="ROOM_FK" type="INTEGER"/>
		<db-attribute name="START_TIME" type="INTEGER"/>
		<db-attribute name="SUBJECT_FK" type="INTEGER"/>
		<db-attribute name="TIMEINTERVAL_ID" type="INTEGER" 
isPrimaryKey="true" isMandatory="true"/>
	</db-entity>
	<db-entity name="VISIBLE_TABLE">
		<db-attribute name="COLUMN_NAME" type="VARCHAR" isMandatory="true" 
length="50"/>
		<db-attribute name="GROUP_FK" type="INTEGER" isMandatory="true"/>
		<db-attribute name="TABLE_NAME" type="VARCHAR" isMandatory="true" 
length="25"/>
		<db-attribute name="VISIBLE_TABLE_ID" type="INTEGER" 
isPrimaryKey="true" isMandatory="true"/>
	</db-entity>
	<obj-entity name="DBProperties" className="de.gstpl.data.DBProperties" 
clientClassName="DBProperties" lock-type="optimistic" 
dbEntityName="DB_PROPERTIES">
		<obj-attribute name="dataMap" type="java.lang.String" 
db-attribute-path="DATA_MAP"/>
		<obj-attribute name="dayDuration" type="java.lang.Integer" 
db-attribute-path="DAY_DURATION"/>
		<obj-attribute name="dayNo" type="java.lang.Integer" 
db-attribute-path="DAY_NO"/>
		<obj-attribute name="dayStart" type="java.lang.Integer" 
db-attribute-path="DAY_START"/>
		<obj-attribute name="defaultRoomCapacity" type="java.lang.Integer" 
db-attribute-path="DEFAULT_ROOM_CAPACITY"/>
		<obj-attribute name="lastMapUpdate" type="java.util.Date" 
db-attribute-path="LAST_MAP_UPDATE"/>
		<obj-attribute name="minTimeInterval" type="java.lang.Integer" 
db-attribute-path="MIN_TIME_INTERVAL"/>
		<obj-attribute name="usefulTimeInterval" type="java.lang.Integer" 
db-attribute-path="USEFUL_TIME_INTERVAL"/>
		<obj-attribute name="version" type="java.lang.String" 
db-attribute-path="VERSION"/>
	</obj-entity>
	<obj-entity name="Group" className="de.gstpl.data.person.Group" 
clientClassName="Group" lock-type="optimistic" dbEntityName="GROUPY">
		<obj-attribute name="name" type="java.lang.String" 
db-attribute-path="NAME"/>
	</obj-entity>
	<obj-entity name="Person" className="de.gstpl.data.Person" 
clientClassName="Person" lock-type="optimistic" dbEntityName="PERSON">
		<obj-attribute name="login" type="java.lang.String" 
db-attribute-path="LOGIN"/>
		<obj-attribute name="name" type="java.lang.String" 
db-attribute-path="NAME"/>
	</obj-entity>
	<obj-entity name="Room" className="de.gstpl.data.Room" 
clientClassName="Room" lock-type="optimistic" dbEntityName="ROOM">
		<obj-attribute name="KIND_U" type="java.lang.String" 
db-attribute-path="KIND_U"/>
		<obj-attribute name="LOCATION_U" type="java.lang.String" 
db-attribute-path="LOCATION_U"/>
		<obj-attribute name="capacity" type="java.lang.Integer" 
db-attribute-path="CAPACITY"/>
		<obj-attribute name="description" type="java.lang.String" 
db-attribute-path="DESCRIPTION"/>
		<obj-attribute name="distance" type="java.lang.Integer" 
db-attribute-path="DISTANCE"/>
		<obj-attribute name="name" type="java.lang.String" 
db-attribute-path="NAME"/>
	</obj-entity>
	<obj-entity name="Subject" className="de.gstpl.data.Subject" 
clientClassName="Subject" lock-type="optimistic" dbEntityName="SUBJECT">
		<obj-attribute name="SEMESTER_U" type="java.lang.Integer" 
db-attribute-path="SEMESTER_U"/>
		<obj-attribute name="description" type="java.lang.String" 
db-attribute-path="DESCRIPTION"/>
		<obj-attribute name="name" type="java.lang.String" 
db-attribute-path="NAME"/>
	</obj-entity>
	<obj-entity name="TimeInterval" className="de.gstpl.data.TimeInterval" 
clientClassName="TimeInterval" lock-type="optimistic" 
dbEntityName="TIMEINTERVAL" superClassName="de.gstpl.data.TimeableImpl">
		<obj-attribute name="durationTime" type="java.lang.Integer" 
db-attribute-path="DURATION_TIME"/>
		<obj-attribute name="startTime" type="java.lang.Integer" 
db-attribute-path="START_TIME"/>
	</obj-entity>
	<obj-entity name="VisibleTable" 
className="de.gstpl.data.person.VisibleTable" lock-type="optimistic" 
dbEntityName="VISIBLE_TABLE">
		<obj-attribute name="columnName" type="java.lang.String" 
db-attribute-path="COLUMN_NAME"/>
		<obj-attribute name="tableName" type="java.lang.String" 
db-attribute-path="TABLE_NAME"/>
	</obj-entity>
	<db-relationship name="visibleTables" source="GROUPY" 
target="VISIBLE_TABLE" toMany="true">
		<db-attribute-pair source="GROUPY_ID" target="GROUP_FK"/>
	</db-relationship>
	<db-relationship name="timeables" source="PERSON" 
target="PERSON_SUBJECT" toMany="true">
		<db-attribute-pair source="PERSON_ID" target="PERSON_FK"/>
	</db-relationship>
	<db-relationship name="person" source="PERSON_SUBJECT" target="PERSON" 
toMany="false">
		<db-attribute-pair source="PERSON_FK" target="PERSON_ID"/>
	</db-relationship>
	<db-relationship name="subject" source="PERSON_SUBJECT" 
target="SUBJECT" toMany="false">
		<db-attribute-pair source="SUBJECT_FK" target="SUBJECT_ID"/>
	</db-relationship>
	<db-relationship name="timeables" source="ROOM" target="TIMEINTERVAL" 
toMany="true">
		<db-attribute-pair source="ROOM_ID" target="ROOM_FK"/>
	</db-relationship>
	<db-relationship name="persons" source="SUBJECT" 
target="PERSON_SUBJECT" toMany="true">
		<db-attribute-pair source="SUBJECT_ID" target="SUBJECT_FK"/>
	</db-relationship>
	<db-relationship name="timeables" source="SUBJECT" 
target="TIMEINTERVAL" toMany="true">
		<db-attribute-pair source="SUBJECT_ID" target="SUBJECT_FK"/>
	</db-relationship>
	<db-relationship name="room" source="TIMEINTERVAL" target="ROOM" 
toMany="false">
		<db-attribute-pair source="ROOM_FK" target="ROOM_ID"/>
	</db-relationship>
	<db-relationship name="subject" source="TIMEINTERVAL" target="SUBJECT" 
toMany="false">
		<db-attribute-pair source="SUBJECT_FK" target="SUBJECT_ID"/>
	</db-relationship>
	<db-relationship name="group" source="VISIBLE_TABLE" target="GROUPY" 
toMany="false">
		<db-attribute-pair source="GROUP_FK" target="GROUPY_ID"/>
	</db-relationship>
	<obj-relationship name="visibleTables" source="Group" 
target="VisibleTable" deleteRule="Cascade" 
db-relationship-path="visibleTables"/>
	<obj-relationship name="timeables" source="Person" target="Subject" 
deleteRule="Nullify" db-relationship-path="timeables.subject"/>
	<obj-relationship name="timeables" source="Room" target="TimeInterval" 
deleteRule="Nullify" db-relationship-path="timeables"/>
	<obj-relationship name="persons" source="Subject" target="Person" 
deleteRule="Nullify" db-relationship-path="persons.person"/>
	<obj-relationship name="timeables" source="Subject" 
target="TimeInterval" deleteRule="Cascade" 
db-relationship-path="timeables"/>
	<obj-relationship name="room" source="TimeInterval" target="Room" 
deleteRule="Nullify" db-relationship-path="room"/>
	<obj-relationship name="subject" source="TimeInterval" target="Subject" 
deleteRule="Nullify" db-relationship-path="subject"/>
	<obj-relationship name="group" source="VisibleTable" target="Group" 
deleteRule="Nullify" db-relationship-path="group"/>
	<query name="Delete" 
factory="org.objectstyle.cayenne.map.SQLTemplateBuilder" root="data-map" 
root-name="GSTPL">
		<property name="cayenne.GenericSelectQuery.fetchingDataRows" 
value="true"/>
		<sql><![CDATA[delete from $table]]></sql>
	</query>
	<query name="GetColumnNames" 
factory="org.objectstyle.cayenne.map.SQLTemplateBuilder" root="data-map" 
root-name="GSTPL">
		<property name="cayenne.GenericSelectQuery.fetchingDataRows" 
value="true"/>
		<sql><![CDATA[select * from $table where 1=2]]></sql>
	</query>
	<query name="GetTI" 
factory="org.objectstyle.cayenne.map.SQLTemplateBuilder" 
root="obj-entity" root-name="TimeInterval">
		<sql><![CDATA[select * from TIMEINTERVAL where
         START_TIME = $start and
         DURATION_TIME = $duration and
         ROOM_ID = $roomId and
         SUBJECT_ID = $subjectId]]></sql>
	</query>
	<query name="SelectTable" 
factory="org.objectstyle.cayenne.map.SQLTemplateBuilder" root="data-map" 
root-name="GSTPL">
		<property name="cayenne.GenericSelectQuery.fetchingDataRows" 
value="true"/>
		<sql><![CDATA[select * from $table]]></sql>
	</query>
	<query name="SetSchema" 
factory="org.objectstyle.cayenne.map.SQLTemplateBuilder" root="data-map" 
root-name="GSTPL">
		<property name="cayenne.GenericSelectQuery.fetchingDataRows" 
value="true"/>
		<sql><![CDATA[set schema $schemaName]]></sql>
	</query>
</data-map>



	
		
___________________________________________________________ 
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de

Re: Incorrect Insert-Statement Order After Deleting All Objects

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Peter,

These chapters touch on the backend architecture, although this is a  
moving target. While we try to keep the user-level API as stable as  
possible, backend is constantly evolving.

http://cwiki.apache.org/CAYDOC/design.html
http://cwiki.apache.org/CAYDOC/runtime-components.html

Cheers,
Andrus


On Dec 21, 2006, at 2:06 AM, Peter Karich wrote:

> Hallo Andrus,
>
> now it works! Thank you for your helpful answers - not only this  
> time :-) I like the cayenne community ...
>
>>> Is this easier in another version >1.2.1 ?
>> No. But it is fairly easy as it is.
>
> Sorry for this question, it was very easy. I though I have to  
> create cayenne from source, but I only need to create the folders  
> and the file in my source!
>
> By the way: Where can I read more about the architecture  
> (DataDomain, DataContext, DataNode, ...) of cayenne? I have googled  
> around, but I can't find something. I think the comments in the  
> source are very useful, but not necessary to understand the 'whole'  
> thing.
>
> Thank you again,
> Peter.
>
> 		
> ___________________________________________________________  
> Telefonate ohne weitere Kosten vom PC zum PC: http:// 
> messenger.yahoo.de
>


Re: Incorrect Insert-Statement Order After Deleting All Objects

Posted by Peter Karich <pe...@yahoo.de>.
Hallo Andrus,

now it works! Thank you for your helpful answers - not only this time 
:-) I like the cayenne community ...

>> Is this easier in another version >1.2.1 ?
> No. But it is fairly easy as it is.

Sorry for this question, it was very easy. I though I have to create 
cayenne from source, but I only need to create the folders and the file 
in my source!

By the way: Where can I read more about the architecture (DataDomain, 
DataContext, DataNode, ...) of cayenne? I have googled around, but I 
can't find something. I think the comments in the source are very 
useful, but not necessary to understand the 'whole' thing.

Thank you again,
Peter.

		
___________________________________________________________ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de

Re: Incorrect Insert-Statement Order After Deleting All Objects

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Dec 18, 2006, at 12:51 PM, Peter Karich wrote:

> So, is there a reset 'button'?

Yes, you can restart the entire stack:

Configuration.getSharedConfiguration().shutdown();
Configuraion.initializeSharedConfiguration();

This will shutdown the stack and re-read all mapping files. But this  
kind of reset won't work if you are changing DataMaps in memory.


>> you will need to reset the EntitySorter on DataDomain.  
>> Unfortunately DataDomain.setEntitySorter(..) is not public in 1.2,
> Is this easier in another version >1.2.1 ?

No. But it is fairly easy as it is.

Andrus

Re: Incorrect Insert-Statement Order After Deleting All Objects

Posted by Peter Karich <pe...@yahoo.de>.
Andrus,

thank you for your reply!

 > So if you are changing the
> mapping dynamically
Thats right. Is there another common approach to do this?
It seems to me very ugly to implement this.
I mean: I only need sth. like 'reset all things of cayenne' 
(configuration, etc.), because schema creation in my application will be 
successful if I do this either
with no entities in it or
at startup.
So, is there a reset 'button'?

> you will need to reset the 
> EntitySorter on DataDomain. Unfortunately DataDomain.setEntitySorter(..) 
> is not public in 1.2,
Is this easier in another version >1.2.1 ?


Peter Karich.





	
		
___________________________________________________________ 
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de

Re: Incorrect Insert-Statement Order After Deleting All Objects

Posted by Andrus Adamchik <an...@objectstyle.org>.
Bad query ordering could be the cause here. So if you are changing  
the mapping dynamically (as your messages hints), you will need to  
reset the EntitySorter on DataDomain. Unfortunately  
DataDomain.setEntitySorter(..) is not public in 1.2, but you can  
always create your own class in "org.objectstyle.cayenne.access"  
package to circumvent Java access rules.

E.g.:

package org.objectstyle.cayenne.access;

public class MyUtil {
      public static void refreshSorter(DataDomain domain) {
          domain.setEntitySorter(new AshwoodEntitySorter 
(domain.getDataMaps()));
      }
}

Andrus


On Dec 14, 2006, at 4:49 PM, Peter Karich wrote:

> Hallo,
>
> After creating the database schema I can successfully insert objects.
> But if I will do the schema creation (DbGenerator.runGenerator)  
> after I already have some objects in the database (so the user can  
> change the mapping!) I will get an error [1], the mapping is in [2].
> To avoid possible caching I deleted all the database, before I  
> overwrite the schema like:
>
> Collection rooms = getAllRooms();
> getContext().deleteObjects(rooms);
> getContext().commitChanges();
>
> Collection tis = getAllTimeIntervals();
> getContext().deleteObjects(tis);
> getContext().commitChanges();
>
> Collection subjects = getAllSubjects();
> getContext().deleteObjects(subjects);
> getContext().getEntityResolver().clearCache();
> getContext().getObjectStore().getDataRowCache().clear();
> getContext().commitChanges();
>
> The problem is (I think) that cayenne think there is a Subject with  
> ID = 349. But there is no subject with this ID! It WAS removed from  
> the database with the schemacreation and with the deleteObjects to  
> make it secure...
> Maybe cayenne calculated an incorrect order of the statements,  
> because sometimes it works sometimes not?
> What is wrong?
> What else should I remove?
> I use Cayenne 1.2.1 and derby 10.2.1.1
>
>
> Thank you in advance, Peter Karich.
>
>
>
>
>
> [1] INFO  QueryLogger: INSERT INTO TIMEINTERVAL (DURATION_TIME,  
> ROOM_FK, START_TIME, SUBJECT_FK, TIMEINTERVAL_ID) VALUES  
> (?, ?, ?, ?, ?)
> INFO  QueryLogger: [bind: 30, 236, 427, 349, 200]
> INFO  QueryLogger: *** error.
> java.sql.SQLException: INSERT on table 'TIMEINTERVAL' caused a  
> violation of foreign key constraint 'SQL061214022418000' for key  
> (349).  The statement has been rolled back.
>         at  
> org.apache.derby.client.am.SQLExceptionFactory.getSQLException 
> (Unknown Source)
>         at org.apache.derby.client.am.SqlException.getSQLException 
> (Unknown Source)
>         at  
> org.apache.derby.client.am.PreparedStatement.executeUpdate(Unknown  
> Source)
>         at  
> org.objectstyle.cayenne.access.jdbc.BatchAction.runAsIndividualQueries 
> (BatchAction.java:224)
>         at  
> org.objectstyle.cayenne.access.jdbc.BatchAction.performAction 
> (BatchAction.java:117)
>         at  
> org.objectstyle.cayenne.access.DataNodeQueryAction.runQuery 
> (DataNodeQueryAction.java:95)
>         at org.objectstyle.cayenne.access.DataNode.performQueries 
> (DataNode.java:309)
>         at  
> org.objectstyle.cayenne.access.DataDomainFlushAction.runQueries 
> (DataDomainFlushAction.java:255)
>         at  
> org.objectstyle.cayenne.access.DataDomainFlushAction.flush 
> (DataDomainFlushAction.java:177)
>         at org.objectstyle.cayenne.access.DataDomain.onSyncFlush 
> (DataDomain.java:830)
>         at org.objectstyle.cayenne.access.DataDomain$2.transform 
> (DataDomain.java:801)
>         at  
> org.objectstyle.cayenne.access.DataDomain.runInTransaction 
> (DataDomain.java:856)
>         at org.objectstyle.cayenne.access.DataDomain.onSync 
> (DataDomain.java:798)
>         at org.objectstyle.cayenne.access.DataContext.flushToParent 
> (DataContext.java:1261)
>         at org.objectstyle.cayenne.access.DataContext.commitChanges 
> (DataContext.java:1165)
>
>
> [2] <?xml version="1.0" encoding="utf-8"?>
> <data-map project-version="1.1">
> 	<property name="defaultLockType" value="optimistic"/>
> 	<property name="defaultPackage" value="de.gstpl.data"/>
> 	<property name="defaultSuperclass" value="Timetable"/>
> 	<property name="clientSupported" value="true"/>
> 	<db-entity name="DB_PROPERTIES">
> 		<db-attribute name="DATA_MAP" type="LONGVARCHAR"  
> isMandatory="true"/>
> 		<db-attribute name="DAY_DURATION" type="INTEGER"  
> isMandatory="true"/>
> 		<db-attribute name="DAY_NO" type="INTEGER" isMandatory="true"/>
> 		<db-attribute name="DAY_START" type="INTEGER" isMandatory="true"/>
> 		<db-attribute name="DB_PROPERTIES_ID" type="INTEGER"  
> isPrimaryKey="true" isMandatory="true"/>
> 		<db-attribute name="DEFAULT_ROOM_CAPACITY" type="INTEGER"  
> isMandatory="true"/>
> 		<db-attribute name="LAST_MAP_UPDATE" type="DATE"  
> isMandatory="true"/>
> 		<db-attribute name="MIN_TIME_INTERVAL" type="INTEGER"  
> isMandatory="true"/>
> 		<db-attribute name="USEFUL_TIME_INTERVAL" type="INTEGER"  
> isMandatory="true"/>
> 		<db-attribute name="VERSION" type="VARCHAR" isMandatory="true"  
> length="10"/>
> 	</db-entity>
> 	<db-entity name="GROUPY">
> 		<db-attribute name="GROUPY_ID" type="INTEGER" isPrimaryKey="true"  
> isMandatory="true"/>
> 		<db-attribute name="NAME" type="VARCHAR" isMandatory="true"  
> length="50"/>
> 	</db-entity>
> 	<db-entity name="PERSON">
> 		<db-attribute name="LOGIN" type="VARCHAR" length="50"/>
> 		<db-attribute name="NAME" type="VARCHAR" isMandatory="true"  
> length="50"/>
> 		<db-attribute name="PERSON_ID" type="INTEGER" isPrimaryKey="true"  
> isMandatory="true"/>
> 	</db-entity>
> 	<db-entity name="PERSON_SUBJECT">
> 		<db-attribute name="PERSON_FK" type="INTEGER" isMandatory="true"/>
> 		<db-attribute name="PERSON_SUBJECT_ID" type="INTEGER"  
> isPrimaryKey="true" isMandatory="true"/>
> 		<db-attribute name="SUBJECT_FK" type="INTEGER" isMandatory="true"/>
> 	</db-entity>
> 	<db-entity name="ROOM">
> 		<db-attribute name="CAPACITY" type="INTEGER"/>
> 		<db-attribute name="DESCRIPTION" type="VARCHAR" length="512"/>
> 		<db-attribute name="DISTANCE" type="INTEGER"/>
> 		<db-attribute name="KIND_U" type="VARCHAR" length="15"/>
> 		<db-attribute name="LOCATION_U" type="VARCHAR" length="15"/>
> 		<db-attribute name="NAME" type="VARCHAR" isMandatory="true"  
> length="50"/>
> 		<db-attribute name="ROOM_ID" type="INTEGER" isPrimaryKey="true"  
> isMandatory="true"/>
> 	</db-entity>
> 	<db-entity name="SUBJECT">
> 		<db-attribute name="DESCRIPTION" type="VARCHAR" length="512"/>
> 		<db-attribute name="NAME" type="VARCHAR" isMandatory="true"  
> length="50"/>
> 		<db-attribute name="SEMESTER_U" type="INTEGER"/>
> 		<db-attribute name="SUBJECT_ID" type="INTEGER"  
> isPrimaryKey="true" isMandatory="true"/>
> 	</db-entity>
> 	<db-entity name="TIMEINTERVAL">
> 		<db-attribute name="DURATION_TIME" type="INTEGER"  
> isMandatory="true"/>
> 		<db-attribute name="ROOM_FK" type="INTEGER"/>
> 		<db-attribute name="START_TIME" type="INTEGER"/>
> 		<db-attribute name="SUBJECT_FK" type="INTEGER"/>
> 		<db-attribute name="TIMEINTERVAL_ID" type="INTEGER"  
> isPrimaryKey="true" isMandatory="true"/>
> 	</db-entity>
> 	<db-entity name="VISIBLE_TABLE">
> 		<db-attribute name="COLUMN_NAME" type="VARCHAR"  
> isMandatory="true" length="50"/>
> 		<db-attribute name="GROUP_FK" type="INTEGER" isMandatory="true"/>
> 		<db-attribute name="TABLE_NAME" type="VARCHAR" isMandatory="true"  
> length="25"/>
> 		<db-attribute name="VISIBLE_TABLE_ID" type="INTEGER"  
> isPrimaryKey="true" isMandatory="true"/>
> 	</db-entity>
> 	<obj-entity name="DBProperties"  
> className="de.gstpl.data.DBProperties"  
> clientClassName="DBProperties" lock-type="optimistic"  
> dbEntityName="DB_PROPERTIES">
> 		<obj-attribute name="dataMap" type="java.lang.String" db- 
> attribute-path="DATA_MAP"/>
> 		<obj-attribute name="dayDuration" type="java.lang.Integer" db- 
> attribute-path="DAY_DURATION"/>
> 		<obj-attribute name="dayNo" type="java.lang.Integer" db-attribute- 
> path="DAY_NO"/>
> 		<obj-attribute name="dayStart" type="java.lang.Integer" db- 
> attribute-path="DAY_START"/>
> 		<obj-attribute name="defaultRoomCapacity"  
> type="java.lang.Integer" db-attribute-path="DEFAULT_ROOM_CAPACITY"/>
> 		<obj-attribute name="lastMapUpdate" type="java.util.Date" db- 
> attribute-path="LAST_MAP_UPDATE"/>
> 		<obj-attribute name="minTimeInterval" type="java.lang.Integer" db- 
> attribute-path="MIN_TIME_INTERVAL"/>
> 		<obj-attribute name="usefulTimeInterval" type="java.lang.Integer"  
> db-attribute-path="USEFUL_TIME_INTERVAL"/>
> 		<obj-attribute name="version" type="java.lang.String" db- 
> attribute-path="VERSION"/>
> 	</obj-entity>
> 	<obj-entity name="Group" className="de.gstpl.data.person.Group"  
> clientClassName="Group" lock-type="optimistic" dbEntityName="GROUPY">
> 		<obj-attribute name="name" type="java.lang.String" db-attribute- 
> path="NAME"/>
> 	</obj-entity>
> 	<obj-entity name="Person" className="de.gstpl.data.Person"  
> clientClassName="Person" lock-type="optimistic" dbEntityName="PERSON">
> 		<obj-attribute name="login" type="java.lang.String" db-attribute- 
> path="LOGIN"/>
> 		<obj-attribute name="name" type="java.lang.String" db-attribute- 
> path="NAME"/>
> 	</obj-entity>
> 	<obj-entity name="Room" className="de.gstpl.data.Room"  
> clientClassName="Room" lock-type="optimistic" dbEntityName="ROOM">
> 		<obj-attribute name="KIND_U" type="java.lang.String" db-attribute- 
> path="KIND_U"/>
> 		<obj-attribute name="LOCATION_U" type="java.lang.String" db- 
> attribute-path="LOCATION_U"/>
> 		<obj-attribute name="capacity" type="java.lang.Integer" db- 
> attribute-path="CAPACITY"/>
> 		<obj-attribute name="description" type="java.lang.String" db- 
> attribute-path="DESCRIPTION"/>
> 		<obj-attribute name="distance" type="java.lang.Integer" db- 
> attribute-path="DISTANCE"/>
> 		<obj-attribute name="name" type="java.lang.String" db-attribute- 
> path="NAME"/>
> 	</obj-entity>
> 	<obj-entity name="Subject" className="de.gstpl.data.Subject"  
> clientClassName="Subject" lock-type="optimistic"  
> dbEntityName="SUBJECT">
> 		<obj-attribute name="SEMESTER_U" type="java.lang.Integer" db- 
> attribute-path="SEMESTER_U"/>
> 		<obj-attribute name="description" type="java.lang.String" db- 
> attribute-path="DESCRIPTION"/>
> 		<obj-attribute name="name" type="java.lang.String" db-attribute- 
> path="NAME"/>
> 	</obj-entity>
> 	<obj-entity name="TimeInterval"  
> className="de.gstpl.data.TimeInterval"  
> clientClassName="TimeInterval" lock-type="optimistic"  
> dbEntityName="TIMEINTERVAL"  
> superClassName="de.gstpl.data.TimeableImpl">
> 		<obj-attribute name="durationTime" type="java.lang.Integer" db- 
> attribute-path="DURATION_TIME"/>
> 		<obj-attribute name="startTime" type="java.lang.Integer" db- 
> attribute-path="START_TIME"/>
> 	</obj-entity>
> 	<obj-entity name="VisibleTable"  
> className="de.gstpl.data.person.VisibleTable" lock- 
> type="optimistic" dbEntityName="VISIBLE_TABLE">
> 		<obj-attribute name="columnName" type="java.lang.String" db- 
> attribute-path="COLUMN_NAME"/>
> 		<obj-attribute name="tableName" type="java.lang.String" db- 
> attribute-path="TABLE_NAME"/>
> 	</obj-entity>
> 	<db-relationship name="visibleTables" source="GROUPY"  
> target="VISIBLE_TABLE" toMany="true">
> 		<db-attribute-pair source="GROUPY_ID" target="GROUP_FK"/>
> 	</db-relationship>
> 	<db-relationship name="timeables" source="PERSON"  
> target="PERSON_SUBJECT" toMany="true">
> 		<db-attribute-pair source="PERSON_ID" target="PERSON_FK"/>
> 	</db-relationship>
> 	<db-relationship name="person" source="PERSON_SUBJECT"  
> target="PERSON" toMany="false">
> 		<db-attribute-pair source="PERSON_FK" target="PERSON_ID"/>
> 	</db-relationship>
> 	<db-relationship name="subject" source="PERSON_SUBJECT"  
> target="SUBJECT" toMany="false">
> 		<db-attribute-pair source="SUBJECT_FK" target="SUBJECT_ID"/>
> 	</db-relationship>
> 	<db-relationship name="timeables" source="ROOM"  
> target="TIMEINTERVAL" toMany="true">
> 		<db-attribute-pair source="ROOM_ID" target="ROOM_FK"/>
> 	</db-relationship>
> 	<db-relationship name="persons" source="SUBJECT"  
> target="PERSON_SUBJECT" toMany="true">
> 		<db-attribute-pair source="SUBJECT_ID" target="SUBJECT_FK"/>
> 	</db-relationship>
> 	<db-relationship name="timeables" source="SUBJECT"  
> target="TIMEINTERVAL" toMany="true">
> 		<db-attribute-pair source="SUBJECT_ID" target="SUBJECT_FK"/>
> 	</db-relationship>
> 	<db-relationship name="room" source="TIMEINTERVAL" target="ROOM"  
> toMany="false">
> 		<db-attribute-pair source="ROOM_FK" target="ROOM_ID"/>
> 	</db-relationship>
> 	<db-relationship name="subject" source="TIMEINTERVAL"  
> target="SUBJECT" toMany="false">
> 		<db-attribute-pair source="SUBJECT_FK" target="SUBJECT_ID"/>
> 	</db-relationship>
> 	<db-relationship name="group" source="VISIBLE_TABLE"  
> target="GROUPY" toMany="false">
> 		<db-attribute-pair source="GROUP_FK" target="GROUPY_ID"/>
> 	</db-relationship>
> 	<obj-relationship name="visibleTables" source="Group"  
> target="VisibleTable" deleteRule="Cascade" db-relationship- 
> path="visibleTables"/>
> 	<obj-relationship name="timeables" source="Person"  
> target="Subject" deleteRule="Nullify" db-relationship- 
> path="timeables.subject"/>
> 	<obj-relationship name="timeables" source="Room"  
> target="TimeInterval" deleteRule="Nullify" db-relationship- 
> path="timeables"/>
> 	<obj-relationship name="persons" source="Subject" target="Person"  
> deleteRule="Nullify" db-relationship-path="persons.person"/>
> 	<obj-relationship name="timeables" source="Subject"  
> target="TimeInterval" deleteRule="Cascade" db-relationship- 
> path="timeables"/>
> 	<obj-relationship name="room" source="TimeInterval" target="Room"  
> deleteRule="Nullify" db-relationship-path="room"/>
> 	<obj-relationship name="subject" source="TimeInterval"  
> target="Subject" deleteRule="Nullify" db-relationship-path="subject"/>
> 	<obj-relationship name="group" source="VisibleTable"  
> target="Group" deleteRule="Nullify" db-relationship-path="group"/>
> 	<query name="Delete"  
> factory="org.objectstyle.cayenne.map.SQLTemplateBuilder" root="data- 
> map" root-name="GSTPL">
> 		<property name="cayenne.GenericSelectQuery.fetchingDataRows"  
> value="true"/>
> 		<sql><![CDATA[delete from $table]]></sql>
> 	</query>
> 	<query name="GetColumnNames"  
> factory="org.objectstyle.cayenne.map.SQLTemplateBuilder" root="data- 
> map" root-name="GSTPL">
> 		<property name="cayenne.GenericSelectQuery.fetchingDataRows"  
> value="true"/>
> 		<sql><![CDATA[select * from $table where 1=2]]></sql>
> 	</query>
> 	<query name="GetTI"  
> factory="org.objectstyle.cayenne.map.SQLTemplateBuilder" root="obj- 
> entity" root-name="TimeInterval">
> 		<sql><![CDATA[select * from TIMEINTERVAL where
>         START_TIME = $start and
>         DURATION_TIME = $duration and
>         ROOM_ID = $roomId and
>         SUBJECT_ID = $subjectId]]></sql>
> 	</query>
> 	<query name="SelectTable"  
> factory="org.objectstyle.cayenne.map.SQLTemplateBuilder" root="data- 
> map" root-name="GSTPL">
> 		<property name="cayenne.GenericSelectQuery.fetchingDataRows"  
> value="true"/>
> 		<sql><![CDATA[select * from $table]]></sql>
> 	</query>
> 	<query name="SetSchema"  
> factory="org.objectstyle.cayenne.map.SQLTemplateBuilder" root="data- 
> map" root-name="GSTPL">
> 		<property name="cayenne.GenericSelectQuery.fetchingDataRows"  
> value="true"/>
> 		<sql><![CDATA[set schema $schemaName]]></sql>
> 	</query>
> </data-map>
>
>
>
> 	
> 		
> ___________________________________________________________ Der  
> frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo!  
> Mail: http://mail.yahoo.de
>