Re: Mapping question
I now have a running version, but the way Thomas proposed would be much nicer. I have added a collection descriptor and he returns both addresses. I tried to modify my getters and setters for addresses to set homeAddress and workAddress, but I tested this and noticed that they are not invoked (why should they? (*grml*)) So I added a function assignAddresses(), which is invoked by the DAO getUser method. public void addressAssignment() { Iterator i = this.adresses.iterator(); while (i.hasNext()) { Adress address = (Address) i.next(); if ("home".equals(adress.getType())) this.homeAddress = address; if ("work".equals(adress.getType())) this.workAddress = address; } } Now I have to take care that every setHomeAddress also modifies the collection (because I don't think that getAddresses() is invoked by ojb either ;) ) May be I implement a query costomizer who filters the addresses like described in the advanced mapping tutorial: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mapping question
Thomas Dudziak wrote: As far as I understand he wants to use a reference that refers to a class with a compound primarykey, where one of the foreignkey values is fixed: Yes, that is what I am searching for. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Mapping question
Sorry for that second posting. I sent this before I subscribed to the list, so I thought it will not be posted (now, with a latency of nearly one day) Regards, Georg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Mapping question
Hi, I have an object "User" who has 2 addresses, home and work. User is mapped to a table user (no problem here). Both home and work address are mapped to a table address. This table has a composite primary key: login and type - login from table user as a foreign key - type is a string (or enum) "home" and "work" I have tried the following without success: in User description: and in Address description: Is it possible to make it run anyhow? Regards, Georg P.S.: Please CC me - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]