-->
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: DDL schema does not follow the overriden column settings
PostPosted: Tue May 03, 2011 2:39 am 
Newbie

Joined: Tue Jul 12, 2005 2:32 am
Posts: 3
I'm exporting a ddl schema (by code using the Hbm2DDLExporter) via my generated entities and there is inheritance hierarchy in my entities structure. I would like a child class to override a parent attribute and make the field length smaller but it seems that the length of the overridden field in the child table schema is still following the length of the parent class. Need some advice in how to implement this.

Thanks.

Code:
@Inheritance( strategy = InheritanceType.TABLE_PER_CLASS )
@Entity
@Table( name = "Parent" )
class Parent{
   @Column( name = "name", length = 8 )
   private String name;
   //....setters getters
}

@Entity
@Table( name = "Child" )
@AttributeOverrides( { @AttributeOverride( name = "name", column = @Column( name = "name", length = 5 ) ) } )
class Child extends Parents{
   //no setter, getter and name attribute defined in child class.
}

The ddl generated for child class
create table parent( name varchar2(8 char) )
create table child( name varchar2(8 char) ) -- the length should be 5 instead


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.