The relationship on the Foo side is composite (hard to show that with an ascii 
drawing) but that fact is irrelevant. The 1..* multiplicity on the Bar side is 
correct. I want to be able to have at least one, but possibly more Bars in my 
Foo (0 Bars is unacceptable). 



It's not much of a real world example, but my application requires this type of 
a relationship which makes the Collection of Bars a required association and 
when the Spring cartridge generates the DAO for a class it adds a create method 
that includes all required attributes of the class it is creating as parameters 
to the method.



Since Bar is the only required association and there are no other required 
attributes the Spring cartridge adds a create method to FooDAO.java called:



create(Collection Bars) { ...



This is where the problem is. Before switching to Andromda 3.1-M1-SNAPSHOT this 
default type for Collections was set, hence the same create method in my dao 
would be:



create(Set Bars) { ... 



Which doesn't cause any problems. 



Having the default association type be Collection in this case causes a compile 
time conflict with another create method that is added by default to the DAO:



create(Collection Foos) { ... 



This create method is added by the Spring cartridge to allow the persistence of 
more then one Foo at a time., which is why modeling the Bars assocation as a 
Collection isn't the right thing to do since my code now doesn't compile!



According to the Hibernate Cartrige documentation the default association type 
is set, not collection:



[url]http://www.andromda.org/andromda-hibernate-cartridge/namespace.html

[/url]



You are supposed to be able to override the default behavior by setting the 
hibernateAssociationCollectionType property for the cartridge, or at the 
relationship level by setting the value of the 
@andromda.hibernate.collection.type=set tagged value to Set. Neither one of 
these work which adds to the problem.



I'm posting this here for one of the Spring cartridge developers to validate 
that I'm either making a newbie mistake or that this really is a problem and 
that I should open a defect. I just upgraded to the 3.1-M1-SNAPSHOT because 
there is a defect in 3.0 that doesn't allow me to apply the 1..* semantics to 
my association (or composition) which is fixed in the newer releases.
_________________________________________________________
Reply to the post : http://galaxy.andromda.org/forum/viewtopic.php?p=1126#1126
Posting to http://forum.andromda.org/ is preferred over posting to the mailing 
list!


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Andromda-user mailing list
Andromda-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/andromda-user

Reply via email to