-->
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.  [ 3 posts ] 
Author Message
 Post subject: Embeddable needs a reference to the object it's embedded in
PostPosted: Wed Feb 08, 2006 6:38 am 
Regular
Regular

Joined: Thu Oct 13, 2005 4:19 am
Posts: 98
In the following code example for a Parent p,
p.getChild1().getParent() != p
but it should be ==.

Code:
@Entity
public class Parent {

   //...

    private Child child1 = new Child ();

    @Embedded
    public Child getChild1() {
        return child1;
    }

    public void setChild1 (Child child1) {
        this.child1 = child1;
    }

}

@Embeddable
public class Child {

   private Parent parent;

   // How do I make parent the parent, instead of a parent?
   public void getParent() { return parent; }
   public void setParent(Parent parent) {this.parent = parent;}

}
[/code]

_________________
http://www.ohloh.net/accounts/ge0ffrey


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 08, 2006 2:45 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
you'll need to implement @Parent, which is probably trivial.
Let me know if you're interested.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 5:49 am 
Regular
Regular

Joined: Thu Oct 13, 2005 4:19 am
Posts: 98
Meanwhile I 've found a work-around by refactoring my design a bit.

If I 'll have need of @Parent (maybe @EmbeddingParent or @EmbeddingContainer is a better name?) I 'll write it and contribute it back,
but to be honest, it doesn't look like I 'll have need of it anytime soon.
It would be a nice feature though.

_________________
http://www.ohloh.net/accounts/ge0ffrey


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

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.