The first example should work.  You might want to show your schema.xml,
to give others some idea what might be wrong.  artist1.getPrimaryKey()
should give the id assigned after saving the object.  It should not be
null.  If it is something is wrong with your xml.

john mcnally

> 
> this doesn't work:
> 
> Artist artist1 = new Artist();
> artist1.setName("Primus");
> artist1.save();
> 
> Website website1 = new Website();
> website1.setName("Primus Online");
> website1.setUrl("http://www.primussucks.com";);
> website1.save();
> 
> ArtistHasWebsite link = new ArtistHasWebsite();
> link.setArtist(artist1);
> link.setWebsite(website1);
> link.save(); //Column 'ARTIST_ID' cannot be null
> 
> this does work:
> 
> Artist artist1 = new Artist();
> artist1.setName("Primus");
> artist1.save();
> 
> Website website1 = new Website();
> website1.setName("Primus Online");
> website1.setUrl("http://www.primussucks.com";);
> website1.save();
> 
> Artist artist2 = ArtistFactory.findByName(artist1.getName());
> Website website2 = WebsiteFactory.findByUrl(website1.getUrl());
> 
> ArtistHasWebsite link = new ArtistHasWebsite();
> link.setArtist(artist2);
> link.setWebsite(website2);
> link.save();
> 
> tried defaultIdMethod native and idBroker by now.
> 
> bye
> fabian
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to