I don't see a simple/automatic solution for this problem. I think you have to
do it with a query. Feels like something that should be coordinated from a
Service, before invoking remove.
You could also consider using an aggregate, to make sure all updates goes
via SequencedItem, but I don't know your domain and maybe it is not an
aggregate.

/Patrik


greatfooty wrote:
> 
> 
> Note a related problem that I'm now pondering though is whats the best
> strategy for dealing with user attempts to remove a referenced Item while
> its still participating in a one-way relationship (like the non-cascaded
> one in this example)?  I've read the sculptor guide re adding validation
> and had figured it'd be wise to include a custom validation method
> annotated with @preremove to check that the Item wasn't in use .. but then
> realised i'd have no relationship to check and seems i can't do the
> validation from that entity itself ie. given that the Item is oblivious to
> what other objects point at it. 
> 
> Is there a neat way to handle this in sculptor to prevent users getting an
> SQLException: Integrity constraint violation? I'm just wanting to return a
> val msg saying something like "Item cannot be removed whilst referenced
> elsewhere" 
> 

-- 
View this message in context: 
http://old.nabble.com/-Sculptor--detached-entity-passed-to-persist--tp27648394s17564p28260143.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Fornax-developer mailing list
Fornax-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Reply via email to