Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] NullPointerException for ManyToOne ingeneric Embeddable

Thanks for the reply and the suggested solution. Incidentally, that is the
route I had had decided on.

It may be of interest to you, the Hibernate folks are working on the same
issue. I happened upon the following (I hope its OK to talk about the
competition here!):
http://opensource.atlassian.com/projects/hibernate/browse/ANN-539 Generics
and @Embedded doesn't work 

And an extension and interesting discussion of the problem here:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-526 Type
aproximation and unbound type limitation 

I could imagine implementing these relationships based on bounds would be
very useful.

Cheers,
Jeff



Guy Pelletier wrote:
> 
> If I understand you correctly you want to do something like this:
> 
> Entity1 {
>  @ManyToOne
>  public Entity3<Integer> entity3;
> }
> 
> Entity2 {
>  @ManyToOne
>  public Entity3<String> entity3;
> }
> 
> Entity 3<X> {
>     public X fooBar;
> }
> 
> Is this correct? If so, no we currently don't support this type of 
> configuration. Internally fooBar is represented as a single mapping with a 
> static type. You may want to append this to the bug you entered previously 
> to have someone at it.
> 
> In the mean time you could use inheritance and a mappedsuperclass to get 
> around this, i.e.:
> 
> RootEntity {}
> 
> MappedSuperclass<X>  extends RootEntity {
>     public X fooBar;
> }
> 
> EntityInteger extends MappedSuperclass<Integer> {}
> 
> EntityString extends MappedSupeclass<String> {}
> 
> Entity1 {
>  @ManyToOne
>  public EntityInteger entityInteger;
> }
> 
> Entity2 {
>  @ManyToOne
>  public EntityString entityString;
> }
> 
> Cheers,
> Guy
> 
> ----- Original Message ----- 
> From: "jml83" <jeffrey.m.leong@xxxxxxxxx>
> To: <eclipselink-users@xxxxxxxxxxx>
> Sent: Tuesday, July 21, 2009 11:29 AM
> Subject: Re: [eclipselink-users] NullPointerException for ManyToOne 
> ingeneric Embeddable
> 
> 
>>
>> It seems this problem is not just for classes marked Embeddable. I
>> removed
>> all embeddables and now I am getting this error for any parametrized
>> reference to an Entity. This would seem to imply this is broken for any
>> domain model with generics. This is surprising, and incredibly 
>> frustrating.
>>
>> Is Eclipselink meant to work with Generics?
>> -- 
>> View this message in context: 
>> http://www.nabble.com/NullPointerException-for-ManyToOne-in-generic-Embeddable-tp24535000p24589987.html
>> Sent from the EclipseLink - Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> eclipselink-users mailing list
>> eclipselink-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>> 
> 
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> 
> 

-- 
View this message in context: http://www.nabble.com/NullPointerException-for-ManyToOne-in-generic-Embeddable-tp24535000p24606774.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top