-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Overriding whole mapping of a map (or collection)
PostPosted: Tue Nov 11, 2008 6:32 am 
Newbie

Joined: Tue Mar 04, 2008 10:37 am
Posts: 6
I am trying to migrate an application from Kodo JDO to Hibernate JPA. I do have a given Table structure and object model. My problem is that our jdo configuration allows to override the name of a join table used for a map in a super class. The following code shows the superclass with the collection to be overridden(The Inheritance strategy is TABLE_PER_CLASS, there is a version and a id field in a super class of OParameterizedADMObjectImpl).


Code:
@MappedSuperclass
public abstract class OParameterizedADMObjectImpl<T extends IADMDataContainer, X extends IADMObjectHandleManager> extends
        ADMObjectImpl<T, X> implements IOParameterizedADMObject<T, X>, IOParameterContext {
   

    @OneToMany(cascade=CascadeType.ALL)
    @MapKey(name = "key")
    @JoinColumn(name="MR_JDOID")
    protected Map<String, OParameter> _parameters = null;



The folowing code shows the class deriving from this one which needs to override the mapping of for OParameterizedADMObjectImpl._parameters

Code:
@Entity
public class SecurityConfig extends OParameterizedADMObjectImpl implements ISecurityConfig, Serializable {
...
}


The given table structure for this case is:
SECURITYCONFIG for the security config class and all derived properties
and
SECUR__PARAMETERS as join table for OParameterizedADMObjectImpl._parameters

Now I want to override the mapping of OParameterizedADMObjectImpl._parameters to use a join table. When I do it in OParameterizedADMObjectImpl it looks the folowing way:


Code:
@MappedSuperclass
public abstract class OParameterizedADMObjectImpl<T extends IADMDataContainer, X extends IADMObjectHandleManager> extends
        ADMObjectImpl<T, X> implements IOParameterizedADMObject<T, X>, IOParameterContext {
   

    @OneToMany(cascade=CascadeType.ALL)
    @MapKey(name = "key")
    @JoinTable(name="SECUR__PARAMETERS",joinColumns=@JoinColumn(name="JDOID", referencedColumnName=""), inverseJoinColumns=@JoinColumn(name="JDOID_VALUE"))
    protected Map<String, OParameter> _parameters = null;


This works for this class but there are other classes deriving from OParameterizedADMObjectImpl and they should have their own join tables for _parameters e.g. TEST_PARAMETERS.

Is there a way to override the first examples mapping e.g. with @AssociationOverride or with @AttributeOverride?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.