Hi all,
I've asked a question a few months ago about inheritance (see:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg11379.html). I picked
up the work I was doing for this little application. To recap I am using the
following datamodel:
- A Medium is any type of medium (could be a VHS tape, a CD, DVD, ...)
- A MediumForSound extends a Medium as it has a tracklist to store all the
tracks.
- A CompactDisc and a Record extend a MediumForSound as they have some
additional properties.
- A MediumContainer is an object to group different media.
- A Case is a MediumContainer to group CDs
- A Sleeve is a MediumContainer to group records
As described in my previous mail I am using the following mapping to map
MediumContainers, Sleeves and Cases:
<class name="kws.mediadb.business.MediumContainer" identity="id">
<map-to table="medium_container"/>
<field name="id" type="string">
<sql name="id" type="varchar"/>
</field>
<field name="title" type="string" required="true">
<sql name="title" type="varchar"/>
</field>
<field name="mediumList" type="kws.mediadb.business.MediumForSound"
collection="vector" get-method="getMediumList" set-method="setMediumList">
<sql many-key="id_medium_container"/>
</field>
</class>
<class name="kws.mediadb.business.Case" identity="id"
extends="kws.mediadb.business.MediumContainer">
<map-to table="case"/>
<field name="id" type="string">
<sql name="id" type="varchar"/>
</field>
</class>
<class name="kws.mediadb.business.Sleeve" identity="id"
extends="kws.mediadb.business.MediumContainer">
<map-to table="sleeve"/>
<field name="id" type="string">
<sql name="id" type="varchar"/>
</field>
</class>
Saving Sleeves and Cases works without a problem. Retreiving them from the
database also works. Updating a Sleeve goes wrong however. These are the
SQL's executed against the database (still Hypersonic SQL 1.7.1):
---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<-
--8<---8<---8<---8<---8<
0:trying to connect user sa
0:SET AUTOCOMMIT FALSE
0:SELECT sleeve.id,medium_container.title,medium_for_sound.id FROM sleeve
LEFT O
UTER JOIN medium_for_sound ON
(sleeve.id=medium_for_sound.id_medium_container),
medium_container WHERE sleeve.id=medium_container.id
0:SELECT medium.title,medium_for_sound.id_medium_container,track.id FROM
medium_
for_sound LEFT OUTER JOIN track ON
(medium_for_sound.id=track.id_medium_for_sou
nd),medium WHERE medium_for_sound.id=medium.id AND
medium_for_sound.id='AE+gYfvV
yjZLrX2UTJUYJ7teMpk='
0:SELECT
track.artist,track.title,track.remix,track.id_medium_for_sound,track.id
_music_genre FROM track WHERE track.id='8dFD6gjAjWJKeQNq87QJ1Z6n0fw='
0:SELECT music_genre.genre FROM music_genre WHERE
music_genre.id='4t0ixgTOF/+Yp0
H4VlocRmnIYLo='
0:SELECT
track.artist,track.title,track.remix,track.id_medium_for_sound,track.id
_music_genre FROM track WHERE track.id='Md29hTzAmYRhZ4490g4pQlnxrG4='
0:SELECT music_genre.genre FROM music_genre WHERE
music_genre.id='FVcZKT6yoU88tw
I5+FYBJU4jc00='
0:SELECT
track.artist,track.title,track.remix,track.id_medium_for_sound,track.id
_music_genre FROM track WHERE track.id='u76C3cM+JHwFsGzlROh4pBsPvO4='
0:COMMIT
0:DISCONNECT
1:trying to connect user sa
1:SET AUTOCOMMIT FALSE
1:UPDATE medium_container SET title='123' WHERE
id='a8xF4Tky5Sfy6c10lRmN5p0idOA=
' AND title='groovy traxx 2'
1:UPDATE sleeve SET WHERE id='a8xF4Tky5Sfy6c10lRmN5p0idOA='
SQLException: SQLState(S0022) vendor code(-28)
1:ROLLBACK
1:DISCONNECT
0:disconnected sa
1:disconnected sa
---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<-
--8<---8<---8<---8<---8<
The update is near the last lines. As you can see, it's updating the
MediumContainer (which is good):
UPDATE medium_container SET title='123' WHERE
id='a8xF4Tky5Sfy6c10lRmN5p0idOA=' AND title='groovy traxx 2'
but it also tries to update something in the 'sleeve' table (resulting in
incorrect SQL).
UPDATE sleeve SET WHERE id='a8xF4Tky5Sfy6c10lRmN5p0idOA='
I 've updated to the latest version of Castor (0.9.5).
Is there someone who can tell me how to solve this?
Many thanks in advance.
regards,
Kenneth
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev