![]() |
![]() |
|
| Index | Recent Threads | Unanswered Threads | Who's Online | User List | Help |
|
|
| No member browsing this thread |
|
Thread Status: Active Total posts in this thread: 12
|
|
| Author |
|
|
Newbie USA Joined: Jul 8, 2008 Post Count: 17 Status: Offline |
I'm working on mapping an object model that I do not control (it's defined by a standards body). They are doing silly things like the following: Address has a field streetName which is of StreetNameType, which extends NameType, which has two String fields name and languageId. I'd like to map this as embedded so I just get two columns within my Address table. However, the docs say that "Embedded PC objects cannot have inheritance..." so I seem to be stuck since StreetNameType does not directly contain the fields I need to map. Is support for inheritance in this scenario forthcoming any time soon? Or, would the best approach be to write a custom mapper based on SingleFieldMultiMapping? Thanks. |
||
|
|
Expert Joined: Nov 16, 2005 Post Count: 804 Status: Offline |
I'm working on mapping an object model that I do not control (it's defined by a standards body). They are doing silly things like the following: Address has a field streetName which is of StreetNameType, which extends NameType, which has two String fields name and languageId. I'd like to map this as embedded so I just get two columns within my Address table. However, the docs say that "Embedded PC objects cannot have inheritance..." so I seem to be stuck since StreetNameType does not directly contain the fields I need to map. Is support for inheritance in this scenario forthcoming any time soon? Or, would the best approach be to write a custom mapper based on SingleFieldMultiMapping? Thanks. What if you declare only StreetNameType as being persistent capable ? I know that is not a solution since other classes might declare plain NameType members but.... Guido ---------------------------------------- Guido Anzuoni http://www.objectmagic.org |
||
|
|
Newbie USA Joined: Jul 8, 2008 Post Count: 17 Status: Offline |
I tried that, and DataNucleus said that it could not find the required fields in StreetNameType. It seems that it does not follow up the chain of superclasses in order to locate the fields. |
||
|
|
Expert UK Joined: Mar 13, 2004 Post Count: 5235 Status: Offline |
It seems that it does not follow up the chain of superclasses in order to locate the fields. Why should it ? they aren't persistable, since not enhanced in that situation. No current plans for support for this feature. Users could, of course, contribute the code, or sponsor features etc etc. open source, blah blah ![]() ---------------------------------------- -Andy ![]() ![]() |
||
|
|
Newbie USA Joined: Jul 8, 2008 Post Count: 17 Status: Offline |
Even when I put all of the relevant classes in the JDO metadata, and enhanced them all, it didn't work, if I recall correctly. Anyway, I've had partial success in writing my own custom mapper. Is it possible to control the column names generated by a SingleFieldMultiMapping? I'll have to write about a dozen of these but then I should be able to persist everything that I need to. |
||
|
|
Newbie USA Joined: Jul 8, 2008 Post Count: 17 Status: Offline |
How long would it take to add support for inheritance to embedded objects? What different areas of the codebase would be affected? |
||
|
|
Expert UK Joined: Mar 13, 2004 Post Count: 5235 Status: Offline |
How long it would take depends on the person. First thing you should look at is the schema generation (under org.datanucleus.store.rdbms.table - AbstractClassTable/ClassTable). Needs all columns of the embedded class, and many checks on superclasses/subclasses (and the inheritance specified in the embedded class). Once you've done that you should try persistence and see what else is needed ---------------------------------------- -Andy ![]() ![]() |
||
|
|
Newbie USA Joined: Jul 8, 2008 Post Count: 17 Status: Offline |
Well, I'm no dummy, but I also have no familiarity with the codebase. I might take a crack at this because all other solutions are proving to be less than satisfactory. Is there anyone else out there who would like to collaborate on this feature? I've located the initial trouble point, the part in EmbeddedMetadata which throws the current error. |
||
|
|
Expert Joined: Nov 16, 2005 Post Count: 804 Status: Offline |
I'm rather busy these days, anyway I can try to take a look because it would be a really great plus. Should we work on 1.1 code base ? Guido ---------------------------------------- Guido Anzuoni http://www.objectmagic.org |
||
|
|
Newbie USA Joined: Jul 8, 2008 Post Count: 17 Status: Offline |
That sounds great. I'll start working on getting the code and figuring out how to build it. Is the 1.1 codebase what's located in the trunk? Feel free to contact me at my direct e-mail address so we can correspond. ---------------------------------------- [Edit 1 times, last edit by aworldnervelink at Feb 26, 2009 4:47:04 PM] |
||
|
|
|
|
|
Current timezone is GMT Mar 17, 2010 11:10:33 PM |