[
http://team.andromda.org:8080/jira/browse/SPRING-8?page=comments#action_10422 ]
greg johnson commented on SPRING-8:
-----------------------------------
chad,
this is only my interpretation, and it may be quite wrong, but ...
p 288 of rod johnson's "j2ee development without ejb" talks about 2 common dao
patterns, a) dao interfaces that have classic crud/jdbc interfaces and b)dao
interfaces that address only first class domain objects, relying on persistence
by reachability for the rest of the object graph.
dao pattern a) implies a default-cascade of "none", while dao pattern b)
implies a default casade of "save-update".
this must have been thought through for the spring cartridge, because the
property "hibernateDefaultCascade" is made available.
for "child" type mappings then,
a) implies a casade of "delete", while for
b) there is still a cascade design choice to be made of "all" or
"all-delete-orphan"
hence the suggestion for another property to handle the "all" or
"all-delete-orphan" design choice.
thinking about it now, i guess what really should be done is have a property
that makes a specific statement about the dao pattern, eg replace the
"hibernateDefaultCascade" property with a "hibernateDaoPattern" property, and
then let the cartridge work out the appropriate cascade settings in different
circumstances.
the "hibernateDaoPattern" could also control the style of dao interfaces that
are generated and .... oops - is that a new cartridge?
and then we are back to the thread that suggests combining cartridges to create
an architecure (eg spring+hibernate+crud-daos or
spring+hibernate+transparent-daos or spring+ejb etc)
then again, the quick & dirty that has worked for me is to add in
hibernate.hbm.xml.vm:
#if (${hibernateDefaultCascade} == "save-update")
#set ($cascade = "all-delete-orphan")
#else
#set ($cascade = "delete")
#end
and replace all cascade="delete" instances with cascade=${cascade}
regards,
greg johnson
> hibernate.hbm.xml.vm does not set cascade for $sourceEnd.one2OnePrimary
> correctly
> ---------------------------------------------------------------------------------
>
> Key: SPRING-8
> URL: http://team.andromda.org:8080/jira/browse/SPRING-8
> Project: Spring Cartridge
> Type: Bug
> Environment: hibernate.hbm.xml.vm
> Reporter: greg johnson
> Assignee: Chad Brandon
>
>
> Symtom:
> Cascaded updates don't work for children if "hibernateDefaultCascade" is set
> to "save-update"
> Problem:
> i think there is a problem with hibernate.hbm.xml.vm at
> "$sourceEnd.one2OnePrimary".
> if "$otherEnd.child = true",then cascade is set unconditionally to "delete",
> which is not correct if "hibernateDefaultCascade" is set to "save-update"
> instead of the default "none".
> Solution:
> at "$sourceEnd.one2OnePrimary" and if "$otherEnd.child = true" then:
> if "hibernateDefaultCascade" is set to "save-update"
> set "cascade=all"
> else
> set "cascade="delete"
> really, there should be another property, eg "hibernateDefaultCascadeDelete",
> to allow a choice of "all" or "all-delete-orphan" for the above case.
> regards,
> greg johnson
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://team.andromda.org:8080/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Andromda-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/andromda-devel