-->
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.  [ 2 posts ] 
Author Message
 Post subject: EmbeddedSuperclass and Entity(access=AccessType.FIELD)
PostPosted: Tue Sep 20, 2005 9:16 pm 
Beginner
Beginner

Joined: Sat Sep 17, 2005 10:41 am
Posts: 49
Hi all,

What is the behavoir of Entity (access=) when combined with an EmbeddedSuperclass?

Since the EmbeddedSuperclass is not an Entity, I see no way of specifying it's access mode (unless I missed something in the documentation?) I am relatively certain that it defaults to access=PROPERTY. (Annotating the fields does not produce the desired DDL--the superclass columns are not rendered as part of the subclass' corresponding table.)

I also know that the subclass MUST access the EmbeddedSuperclass by property, even if the subclass was annotated Entity(access=FIELD).

Is it safe to assume that field access won't work when using an EmbeddedSuperclass? This is kind of a bummer since I think annotating the fields produces cleaner code, but understandable given Java's introspection capabilities. (I even made the fields in the superclass protected, but that still didn't work!)

Please reference the code examples below:

Code:
@EmbeddedSuperclass
public abstract class MyBaseClass
{
Long id ;

@Id
public Long getLong () { return this.id ; }
public void setLong (Long id) { return this.id = id ; }
}


And I have another class like this:

Code:
@Entity (access=AccessType.FIELD)
public class MyDerivedClass extends MyBaseClass
{
@Column (length = 64)
String name ;

public String getName () { return this.name ; }
public void setName (String name) { this.name = name ; }
}


NOTE: I want "MyDerivedClass" to map to a table that has both id and name columns.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 21, 2005 5:43 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
@EmbeddableSuperclass(access=AccessType.FIELD)

_________________
Emmanuel


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