-->
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: SchemaExport, w/legacy tables
PostPosted: Wed Jul 27, 2005 6:33 pm 
Newbie

Joined: Wed Jul 27, 2005 6:11 pm
Posts: 1
Location: Boulder, CO
Hibernate version: 2.x

Application has an already existing table like this (Oracle 9i fwiw):

create table legacy
(
primary_key number(38) not null,
some_field varchar(20)
)

Created class LegacyPOJO for table legacy along with suitable .hbm.xml mapping file.

Created class NewEntityPOJO plus mapping file for new entity that is related to LegacyPOJO. Relationship is 1 to many, LegacyPOJO to NewEntityPOJO. That is to say a NewEntityPOJO is related to one LegacyPOJO. A LegacyPOJO is related to many NewEntityPOJO's.

Now I would like to use SchemaExport to generate the DDL for creating the table to persist NewEntityPOJO objects. I am doing this via Ant. I initally had it generate DLL for **/*.hbm.xml but of course I got create table statements for a table for LegacyPOJO. Don't want that, it already exists, I just want the create table statement for the NewEntity table. So I change the Ant task to just work on **/NewEntityPOJO.hbm.xml but it isn't happy because it's aware of the relationship to LegacyPOJO.

Specifically I get:

Schema text failed: An association from the table NewEntity refers to an unmapped class: com.whatever.model.LegacyPOJO

NewEntityPOJO.hbm.xml has a <many-to-one ...> element relating it to LegacyPOJO thus:

<many-to-one name="legacyPOJO" column="legacy_pojo_recid" class="LegacyPOJO" not-null="true" />

Any way around this? Or am I going to have to hand-craft DDL for my new POJOs/TABLES because of this half-and-half situation I'm in?

Thanks for any thoughts on this...

Jon


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 28, 2005 2:00 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
generate sql for the whole thing and delete nonwanted create or contribute code that handles it (e.g. by a blacklist of tables or something=)

_________________
Max
Don't forget to rate


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.