Hi Lester, IMHO it seems that current implementation of SecuritySet is unmappable with Hibernate. Same will be true about every other object. Since JavaGenerics are still missing a O/R Mapper has to use add(Object) to attach an object into a Set or a other Collection.
SecuritySet is currently backed by a TreeMap, so add(Object) won't work as you cannot put an element to a set without any key. The JavaDoc needs be get patched to point that out!!! Maybe you can try to use hibernates <map/> "mapping" ;) to get all SecuritySets's mapped to database. But I can imaging this fails as a Security has the wrong interface for this purpose. Any other suggestions?!? Bye Toby > -----Urspr�ngliche Nachricht----- > Von: Lester Ward [mailto:[EMAIL PROTECTED] > Gesendet: Donnerstag, 24. Juni 2004 19:31 > An: Turbine User Mailing List (E-mail) > Betreff: Fulcrum SecuritySet error > > > I'm using Fulcrum's security component to use Hibernate with > Turbine 2.3. > Using the dynamic security model, I'm running into an issue. > I'm subclassing > the security objects from Fulcrum such as > org.apache.fulcrum.security.model.dynamic.entity.DynamicGroup. > I have code > that looks like this: > > Set roles = a_Group.getRolesAsSet(); > Role role = (Role)m_RolesByName.get(k_RoleUser); > roles.add(role); > > I get this exception: > > java.lang.RuntimeException: not implemented > at > org.apache.fulcrum.security.util.SecuritySet.add(SecuritySet.java:257) > at net.sf.hibernate.collection.Set.add(Set.java:156) > at com.tagaudit.humpback.Humpback.attachRoles(Humpback.java:424) > at > com.tagaudit.humpback.Humpback.translateUser(Humpback.java:366) > at com.tagaudit.humpback.Humpback.walkUsers(Humpback.java:316) > at com.tagaudit.humpback.Humpback.run(Humpback.java:111) > at com.tagaudit.humpback.Humpback.main(Humpback.java:87) > > This appears to be caused be an odd combination of things: > > 1) The SecuritySet.add(Object) method throws an unimplemented > exception, > apparently because it's subclasses have typed add() method > that the author > wants to be called instead of the generic add(Object) method. > > 2) In the code, my roles object is a > net.sf.hibernate.collection.Set object. > This object is evidently a proxy wrapped around another Set, > in this case an > org.apache.fulcrum.security.util.RoleSet. > > 3) The RoleSet object has an add(Role) method and is a subclass of > SecuritySet. > > 4) Hibernate's Set.add method looks like this: > > public boolean add(Object value) > { > write(); > return set.add(value); > } > > 5) Since the Hibernate add takes an object, when it calls > set.add(), it ends > up invoking the add(Object) call of the RoleSet object. Since > this object > doesn't have one of those, it invokes the add(Object) method of its > superclass, which throws the unimplemented exception (see > item 1 above). > > Now, as near as I can tell, this means I'm pretty much hosed. > I have to > alter either Fulcrum's set objects, Hibernate's set objects > or both to fix > this problem. > > Anyone have any advice for solving this? > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
