-->
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.  [ 4 posts ] 
Author Message
 Post subject: Define class for @Embeddable member
PostPosted: Wed Dec 28, 2005 5:10 pm 
Newbie

Joined: Wed Dec 28, 2005 1:18 pm
Posts: 5
I have a member which is an interface reference. I am mapping as @Embedded and would like to specify the concrete class that will be used for the embedded mapping much like the targetEntity on entity relationships. Is there such a thing?

@Embedded(targetType=StreetAddressImpl.class)
private IStreetAddress streetAddress;

I seem to have to make streetAddress a concrete type which isn't ideal as it requires making some changes to the internal API

@Embedded
private StreetAddressImpl streetAddress;

In this case it doesn't really matter but it seems like there should be a parallel to targetEntity in the @Embedded annotation.

Maybe there is a different approach?

(Hibernate annotations 3.1 beta 7)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 02, 2006 6:25 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
This will not be part of EJB3 but post a JIRa issue, I might add it.
@Type can solve you immediate problem though.

_________________
Emmanuel


Top
 Profile  
 
 Post subject: Concrete type for @Embedded and @CollectionOfElements
PostPosted: Mon Jan 16, 2006 4:19 pm 
Newbie

Joined: Wed Dec 28, 2005 1:18 pm
Posts: 5
As a followup... I have a similar issue with @CollectionOfElements and was hoping you could explain how to use @Type in these situations.

I am using the following:
Hibernate 3.1
Hibernate Annotations 3.1beta7
Hibernate Entity Manager 3.1beta5

@Embedded
public class StreetAddress implements IStreetAddress {
...
}

@Entity
public class SomeEntity {

@CollectionOfElements
@JoinTable( ... )
// Here I have to do something with @Type to indicate that this
// collection should be of StreetAddresses
private List<IStreetAddress> addresses = new ArrayList<IStreetAddress>();

}

My understanding of @Type is that I need to implement an UserType for StreetAddress? Is there a way to leverage the annotations in StreetAddress by just specifying StreetAddress.class? Is there a built-in UserType that will take an @Embedded class and do the right thing?

I appreciate the help. I just need to be pointed in the right direction.

Thanks,
A.J.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 17, 2006 7:19 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
no the user type has to persist your StreetAddress in a specific manner

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.