Hi Marcus (and everybody else), thanks for your VO documentation post. I like it, though I think documentation for both uni- and bidirectional relationships should be included as well as documentation on one-to-one relationships. Besides, I believe there are some more attributes you left out probably unintentionally. For example, I remember that I came across something called like instantiation="eager" once in the mailing list. I never found a good explanation of what this does though. Maybe Vincent could comment on this, as he started the VO creation addition, I think. Anyway, I'm already successfully using XDoclet's VO feature and love it, still would like to have a more thorough explanation of all the parameters and features it offers.
Another thing...a while ago me and Chuck Irvine posted two bug reports (XDT-102 and XDT-107) on JIRA on the same issue (see clippings from mailing list conversation between Chuck and me below; seems you (Marcus) also participated in this conversation and believed our reported behavior was a bug). Anyway, unfortunately nobody has tackled or commented on this on JIRA up to now. I think it's real important since as is described in the docs for composed relationships one entity is responsible for the creation of the other. This works fine, as you describe for one-to-many relationships, for one-to-one however, the dependent entity is not created automatically and has to be created manually before. This is a bit awkward, also the relationship (for one-to-one) is not set automatically, only the value. Cheers, Bernhard -----Ursprüngliche Nachricht----- Von: Meyer-Willner, Bernhard [mailto:Meyer-WillnerB@;logica.com] Gesendet: Donnerstag, 24. Oktober 2002 16:52 An: '[EMAIL PROTECTED]' Cc: '[EMAIL PROTECTED]' Betreff: Re: [Xdoclet-user] Do value-objects support 1-to-1 compose relati onships? Hi, I don't think two methods is necessary. I repeat my proposition here: Check if the dependent object with the specified PK can be found and if not call it create method and set its value. If the relationship is one-to-many it already works like this, because the client of a value object uses the add/update/remove methods to add/update/remove a dependent object on the many side and thus the setXXXValue method can distinguish between the three cases. In case of a one-to-one relationship it's even easier. First try to find the dependent object. If its found, we can set its valuie. If it can't be found, the container throws an ObjectNotFoundException. This means it's not there, so it has to be created by calling its create method and then setting its value, respectiveley calling its create method which takes a VO as a parameter. Cheers, Bernhard -----Ursprüngliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:Chuck.R.Irvine@;mail.sprint.com] Gesendet: Donnerstag, 24. Oktober 2002 16:39 An: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Betreff: RE: [Xdoclet-user] Do value-objects support 1-to-1 compose relati onships? Pazu stated that he thought this was a bug, but after thinking about it for a while, I'm wondering if it's more of a design issue. Say that you have two beans, OwnerBean and ComponentBean, the latter being a component of the former. The question is, what is the scope of functionality intended by the SuperCMP.setSuperValue method? More specifically, should setSuperValue be used for both database updates and database inserts? In the case of db insertion, the method should assume that the dependent object needs to be created in the database and create it. In the case of db update, the method should assume that the object already is represented in the database, find it, and update it. These are two very different cases and I wonder how a single method could have the necessary information to distinguish between the two. Instead of setSuperValue, perhaps the value-object facilty should generate two methods, createSuperValue and updateSuperValue, which client code could call depending on the desired functionality? Comments? Thanks. Chuck -----Original Message----- From: Meyer-WillnerB [mailto:Meyer-WillnerB@;logica.com] Sent: Tuesday, October 22, 2002 2:21 AM To: Chuck.R.Irvine; xdoclet-user Subject: Re: [Xdoclet-user] Do value-objects support 1-to-1 compose relati onships? Personally, I experienced the same thing. We only have unidirectional relationships in our project. For One-to-Many it works just fine and one can see that in the CMP class the necessary code to create the dependent objects is generated. For One-to-One, however, it just like Chuck states. In setXXXValue() for an object with multiplicity one code like the attached is generated: This works if the dependent object already exists, then it can be found by its PK and the value for it can be set. However if I create a new value object graph with one-to-one relationships and call setXXXValue() on my parent object the call fails since the dependent objects don't yet exist. Is this behavior intended or not. If not, I'd happily contribute a patch to the template which would make more sense to me, i.e. check if the dependent objects with the specified PK can be found and if not call it create method and set its value. What do y'all think out there? Thanks. Bernie Attached code copied from Chucks message: { // Checks for null aggregate if (valueHolder.getResourceValue() != null) { com.sprint.fmsD.genequip.ejb.pk.ResourcePK pk = new com.sprint.fmsD.genequip.ejb.pk.ResourcePK(valueHolder.getResourceValue( ).getResourceID()); com.sprint.fmsD.genequip.ejb.interfaces.ResourceLocalHome home = com.sprint.fmsD.genequip.ejb.util.ResourceUtil.getLocalHome(); com.sprint.fmsD.genequip.ejb.interfaces.ResourceLocal relation = home.findByPrimaryKey(pk); relation.setResourceValue(valueHolder.getResourceValue()); } } } -----Ursprüngliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:Chuck.R.Irvine@;mail.sprint.com] Gesendet: Montag, 21. Oktober 2002 22:52 An: [EMAIL PROTECTED] Betreff: [Xdoclet-user] Do value-objects support 1-to-1 compose relationships? I'm trying to determine whether value-objects support 1-to-1 compose relationships. By examining the XDoclet sample project, I think I understand how 1-to-N relationships are supported, but I don't see any examples of 1-to-1 compose relationships. In an archived mailing list posting, Pazu states that parent objects in compose relationships automatically create and remove their dependent objects, and in the sample project I can see that happening for the Customer-Shipping_Address relationship. However, for a 1-to-1 relationship that I'm implementing, I don't see it happening. The relevant extracts from my Bean class and the corresponding CMP class are attached. Thanks for your help. Chuck ************************ Bean Class Extract ************************ /** * Returns related Resource * * @return related com.sprint.fmsD.genequip.ejb.interfaces.ResourceLocal * * @ejb.interface-method * view-type="local" * * @ejb.relation * name="port-resource" * role-name="port-has-resource" * target-ejb="Resource" * target-role-name="resource-has-port" * * @weblogic.column-map * foreign-key-column="RSRC_ID" * key-column="RSRC_ID" * * @ejb.value-object * match="*" * compose="com.sprint.fmsD.genequip.ejb.vo.ResourceValue" * compose-name="ResourceValue" */ public abstract ResourceLocal getResource() /** * Sets related Resource * * @param related com.sprint.fmsD.genequip.ejb.interfaces.ResourceLocal * @ejb.interface-method * view-type="local" * @param resource the new CMR value */ public abstract void setResource(ResourceLocal resource); ************************************* CMP Class Extract **************************************** /* Value Objects BEGIN */ private com.sprint.fmsD.genequip.ejb.vo.PortValue PortValue = null; public com.sprint.fmsD.genequip.ejb.vo.PortValue getPortValue() { PortValue = new com.sprint.fmsD.genequip.ejb.vo.PortValue(); try { PortValue.setPortID( getPortID() ); PortValue.setNodeResourceID( getNodeResourceID() ); PortValue.setFmsSiteNumber( getFmsSiteNumber() ); PortValue.setLineupNumber( getLineupNumber() ); PortValue.setMaintenanceUserIdentifier( getMaintenanceUserIdentifier() ); PortValue.setMaintenanceTransactionIdentifier( getMaintenanceTransactionIdentifier() ); PortValue.setMaintenanceFunctionIndicatorCode( getMaintenanceFunctionIndicatorCode() ); PortValue.setMaintenanceDate( getMaintenanceDate() ); if ( getResource() != null ) PortValue.setResourceValue( getResource().getResourceValue() ); } catch (Exception e) { throw new javax.ejb.EJBException(e); } return PortValue; } public void setPortValue( com.sprint.fmsD.genequip.ejb.vo.PortValue valueHolder ) { try { setNodeResourceID( valueHolder.getNodeResourceID() ); setFmsSiteNumber( valueHolder.getFmsSiteNumber() ); setLineupNumber( valueHolder.getLineupNumber() ); setMaintenanceUserIdentifier( valueHolder.getMaintenanceUserIdentifier() ); setMaintenanceTransactionIdentifier( valueHolder.getMaintenanceTransactionIdentifier() ); setMaintenanceFunctionIndicatorCode( valueHolder.getMaintenanceFunctionIndicatorCode() ); setMaintenanceDate( valueHolder.getMaintenanceDate() ); // Anonymous block to allow variable declations without conflicts { // Checks for null aggregate if (valueHolder.getResourceValue() != null) { com.sprint.fmsD.genequip.ejb.pk.ResourcePK pk = new com.sprint.fmsD.genequip.ejb.pk.ResourcePK(valueHolder.getResourceValue( ).getResourceID()); com.sprint.fmsD.genequip.ejb.interfaces.ResourceLocalHome home = com.sprint.fmsD.genequip.ejb.util.ResourceUtil.getLocalHome(); com.sprint.fmsD.genequip.ejb.interfaces.ResourceLocal relation = home.findByPrimaryKey(pk); relation.setResourceValue(valueHolder.getResourceValue()); } } } catch (Exception e) { throw new javax.ejb.EJBException(e); } } /* Value Objects END */ ------------------------------------------------------- This sf.net emial is sponsored by: Influence the future of Java(TM) technology. Join the Java Community Process(SM) (JCP(SM)) program now. http://ad.doubleclick.net/clk;4699841;7576298;k?http://www.sun.com/javavote _______________________________________________ Xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. ------------------------------------------------------- This sf.net email is sponsored by: Influence the future of Java(TM) technology. Join the Java Community Process(SM) (JCP(SM)) program now. http://ad.doubleclick.net/clk;4729346;7592162;s?http://www.sun.com/javavote _______________________________________________ Xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. ------------------------------------------------------- This sf.net email is sponsored by: Influence the future of Java(TM) technology. Join the Java Community Process(SM) (JCP(SM)) program now. http://ad.doubleclick.net/clk;4729346;7592162;s?http://www.sun.com/javavote _______________________________________________ Xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user