[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1853) CREATE SCHEMA inside database-object need to execute before tables are created

roy (JIRA) noreply at atlassian.com
Tue Jan 11 05:48:06 EST 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=39564#action_39564 ] 

roy commented on HHH-1853:
--------------------------

in applicationContext.xml don't use <property name="generateDdl" value="true"/>
in persistence.xml use 
   <persistence-unit name="sample" transaction-type="RESOURCE_LOCAL">
      <properties>
         <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
         <property name="hibernate.default_schema" value="yourschema" />
         <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
      </properties>
   </persistence-unit>

> CREATE SCHEMA inside database-object need to execute before tables are created
> ------------------------------------------------------------------------------
>
>                 Key: HHH-1853
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1853
>             Project: Hibernate Core
>          Issue Type: Improvement
>    Affects Versions: 3.1.3
>         Environment: hsqldb 1.8.0
>            Reporter: Mattias Jiderhamn
>            Priority: Minor
>         Attachments: create-schema.patch, create-schema2.patch
>
>
> In order to have Hibernate create database schemas for hsqldb, you have to insert a <database-object> in your mapping file (http://forums.hibernate.org/viewtopic.php?p=2305138). Problem is, all the database-object statements are executed after the tables are created, so tables in non-default schemas will not be created. To get around this, you have to first use Configuration.generateSchemaCreationScript() to get the schemas, and then Configuration.generateSchemaUpdateScript() to get the tables inside the schemas.
> (This is a bit problematic when using Springs LocalSessionFactoryBean)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list