-->
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: hbm2ddl generates an invalid column name (with '.' sign)
PostPosted: Wed Mar 18, 2009 9:10 am 
Newbie

Joined: Wed Feb 25, 2009 3:17 am
Posts: 5
Location: Germany
Hello,

hbm2ddl generates a create table statement where the column names contain the dot character - while the used database Derby won't accept such a statement.

I'm using the org.hibernate.dialect.DerbyDialect and the org.hibernate.cfg.DefaultComponentSafeNamingStrategy for column names, which works fine for most of the mappings.

The problem occurs where the mapped domain model object has a primary key consisting of multiple columns and contains a persistent array of objects. hbm2ddl generates a new table for the array of objects contained in the domain object model. This new array table's columns referencing the primary key columns of the domain model object have names containing dot characters.

Simplified code example:

Code:
@Entity class X {
    @Id ID id;
    @org.hibernate.annotations.CollectionOfElements
    @org.hibernate.annotations.IndexColumn(name="arrayIndex") Y[] y;
    ...
}

@Embeddable class ID {
    String id1;
    String id2;
}


tries to generate a new table for the Y[] member:

Code:
create table X_y (
    X_id.id1 varchar(255) not null,
    X_id.id2 varchar(255) not null,
    ...


Can I forbid the dot character for column names generated by hbm2ddl? Is the DefaultComponentSafeNamingStrategy configurable?

Thank you,
best regards,
Robert


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.