SaveDeep

2 views
Skip to first unread message

uoccou

unread,
Jun 8, 2010, 12:03:36 PM6/8/10
to jenabean-dev
If I have an object with a property that is another object, and I want
to save it, and retain a reference to the embedded object what should
I do ?

I dont want the embedded object, which may have properties I dont want
updated just yet to be saved just because the toplevel object is being
saved - so I thought doing a "save" rather than a "saveDeep" would
work here - but it doesnt seem to.

Am I expecting the wrong thing here from saveDeep ? If so, how should
I go about this scenario ?

Taylor Cowan

unread,
Jun 12, 2010, 9:09:14 AM6/12/10
to jenabe...@googlegroups.com
Now the embedded properties are treated as simple primitive types like
a string or int and always get updated. I think we need to modify
JenaBean to fix this scenario.

Taylor

> --
> You received this message because you are subscribed to the Google Groups "jenabean-dev" group.
> To post to this group, send email to jenabe...@googlegroups.com.
> To unsubscribe from this group, send email to jenabean-dev...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/jenabean-dev?hl=en.
>
>

Taylor Cowan

unread,
Jun 12, 2010, 9:13:47 AM6/12/10
to jenabe...@googlegroups.com
First thoughts...some kind of flag or configuration may be necessary
to induce this, since it's been released so long with a different
behavior.

uoccou

unread,
Jun 13, 2010, 2:48:41 PM6/13/10
to jenabe...@googlegroups.com, Taylor Cowan
I need to look into it in more detail, again, after a rubbish week working on something else. But perhaps you can say off the top of your head :

The scenario is that I have reference objects that may get surfaced on a webpage. Things happen on the page that mean a user can save an object that needs a reference to one of those reference data. Eg "DogOwner" may need a reference to "Labrador" via a Dog property.. The form on the page submits the info - I get a param that tells me the id for the previously read "Labrador",

I create an object of type Dog and set the id to Labrador. I dont set the other properties that might be needed - I don't want to spend the time/network/resources/cycles to retrieve the Labrador instance from the rdf database again.

The DogOwner class still needs a populated Dog property - but in the RDF, this will materialize as a triple something like
http://myDogApp/DogOwner http://dogs/hasDog http://dogs/id/labrador.
So - http://dogs/id/labrador is all thats needed in DogOwner; the individual that represents the labrador and all its properties exists in rdf already, in my ontology vocabulary, and I dont want to change it.

  • Does saveDeep(), with this temporary Labrador instance I have, overwrite the fully populated ontology individual ?
  • Does save not do this ?
In looking at the code I see the forceDeep and shallow flags, and a call to saveOrUpdate. What happens here currently, and what do I need to do - do I need to retrieve my reference data before setting it as property on an object that uses it in composition, or will the saveOrUpdate just update the fully populated pre-existing individual ?

If a flag or "saveShallow" method is needed I can live with that and I'll still need a deepSave() from time to time. And in looking at Empire I might expect the same issue to crop up.
Reply all
Reply to author
Forward
0 new messages