• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

database schema definition outside of hbm files?

 
Preetham Chandrasekhar
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Here's my situation:

1. Currently I have the name of the schema declared in the hbm.xml file as follows - <class name="a.b.c.SaveMe" table="SAVE_ME" schema="x">

2. I would like to extract this 'schema' outside of the hbm.xml file...say in the oracle-ds.xml.
3. I am using the oracle thin driver to establish the connectivity.

Any help would be appreciated!

Thanks
Preetham
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Um, pardon my really bad memory, but can't you just put the schema information in the hibernate.cfg.xml file?

Mark
 
Preetham Chandrasekhar
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark,

You are right...there is a property in the persistence.xml: <property name="hibernate.hbm2ddl.auto" value="update/create" />

But 'update' doesnt create a new schema...and 'create' deletes the schema everytime it is run...and since this is part of the j2ee application...I dont want the shcema to be created everytime I restart my application server.

I was trying to figure out if there is a property in say oracle-ds.xml where you can append to schema to the connection url...and there doesnt seem to be one...are you aware of anything?

Also...there is this hibernate-tools.jar which uses ant task to create a schema...though this happens at build time...
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, I must have been very confused. I thought you were referring to wanted to be able to tell the queries to append a schema, so that it can get the data, instead of having it in all the hbm files or query strings.

I wasn't thinking in terms of database table creation.

Sorry.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic