cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <jer...@media.demon.co.uk>
Subject Re: [cforms] Repeater Binding Revisited.
Date Wed, 31 Mar 2004 11:00:24 GMT

On 30 Mar 2004, at 08:13, Marc Portier wrote:

> in fact, this approach makes a question pop up to the hibernate and 
> ojb experts out there:

I might not exactly be an expert ..... but I use Hibernate regularly

>
> will this moving to buffer collection just work or am I to consider 
> some constraints while doing so?
>

What appears to be the case is this:

You can do what you like with the Collection Object in terms of 
replacing it etc., but never replace the original Elements in the 
Collection or you will break their binding to the DB.

Here is some code from one of my test suites to test for Collection 
replacement,
'scenario', 'album1' and 'album2' were objects already existing in the 
DB.

	List newAlbums = new ArrayList ();
	newAlbums.add (album2);
	newAlbums.add (album1);
	scenario.setAlbums (newAlbums);
	scenarioid = ScenarioPeer.save (SESSION, scenario);
	assertNotNull ("Scenario was not saved.", scenarioid);


New Collection Elements typically get a unique ID only after they have 
been persisted because the ID is generally auto-generated by the DB.

Sparse Elements are a common requirement.

HTH

regards Jeremy

Mime
View raw message