Welcome Guest  |  Register  |  Login
Login Name Password
  Search  
  Index  | Recent Threads  | Unanswered Threads  | Who's Online  | User List  | Help


Quick Go »

No member browsing this thread
Thread Status: Active
Total posts in this thread: 12
Posts: 12   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 1254 times and has 11 replies Next Thread
Male aworldnervelink
Newbie
Member's Avatar

USA
Joined: Jul 8, 2008
Post Count: 17
Status: Offline
Reply to this Post  Reply with Quote 
Embedded PC objects cannot have inheritance?

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.
[Feb 20, 2009 12:26:06 AM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male ganzuoni
Expert
Member's Avatar


Joined: Nov 16, 2005
Post Count: 804
Status: Offline
Reply to this Post  Reply with Quote 
Re: Embedded PC objects cannot have inheritance?

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
[Feb 20, 2009 12:32:15 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male aworldnervelink
Newbie
Member's Avatar

USA
Joined: Jul 8, 2008
Post Count: 17
Status: Offline
Reply to this Post  Reply with Quote 
Re: Embedded PC objects cannot have inheritance?

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.
[Feb 20, 2009 3:34:56 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male andy
Expert
Member's Avatar

UK
Joined: Mar 13, 2004
Post Count: 5235
Status: Offline
Reply to this Post  Reply with Quote 
Re: Embedded PC objects cannot have inheritance?

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 wink
----------------------------------------
-Andy smile

[Feb 20, 2009 5:58:21 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male aworldnervelink
Newbie
Member's Avatar

USA
Joined: Jul 8, 2008
Post Count: 17
Status: Offline
Reply to this Post  Reply with Quote 
Re: Embedded PC objects cannot have inheritance?

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.
[Feb 20, 2009 11:38:29 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male aworldnervelink
Newbie
Member's Avatar

USA
Joined: Jul 8, 2008
Post Count: 17
Status: Offline
Reply to this Post  Reply with Quote 
Re: Embedded PC objects cannot have inheritance?

How long would it take to add support for inheritance to embedded objects? What different areas of the codebase would be affected?
[Feb 24, 2009 8:30:48 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male andy
Expert
Member's Avatar

UK
Joined: Mar 13, 2004
Post Count: 5235
Status: Offline
Reply to this Post  Reply with Quote 
Re: Embedded PC objects cannot have inheritance?

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 smile

[Feb 25, 2009 7:34:26 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male aworldnervelink
Newbie
Member's Avatar

USA
Joined: Jul 8, 2008
Post Count: 17
Status: Offline
Reply to this Post  Reply with Quote 
Re: Embedded PC objects cannot have inheritance?

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.
[Feb 26, 2009 2:10:53 AM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male ganzuoni
Expert
Member's Avatar


Joined: Nov 16, 2005
Post Count: 804
Status: Offline
Reply to this Post  Reply with Quote 
Re: Embedded PC objects cannot have inheritance?

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
[Feb 26, 2009 9:00:19 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male aworldnervelink
Newbie
Member's Avatar

USA
Joined: Jul 8, 2008
Post Count: 17
Status: Offline
Reply to this Post  Reply with Quote 
Re: Embedded PC objects cannot have inheritance?

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]
[Feb 26, 2009 3:37:50 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 12   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread