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
|
|