[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-4594) SchemaExport does not ignore the hibernate.default_schema property if it is not set

Stefan Rufer (JIRA) noreply at atlassian.com
Thu Nov 19 19:38:08 EST 2009


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4594?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Rufer  updated HHH-4594:
-------------------------------

    Attachment: hibernate4594-tests.zip

More tests (replaces last file with same name). 

> SchemaExport does not ignore the hibernate.default_schema property if it is not set
> -----------------------------------------------------------------------------------
>
>                 Key: HHH-4594
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4594
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.1
>         Environment: Hibernate 3.3.1.GA, derby 10.4.2.0, Spring 2.5.6.SEC01
>            Reporter: Stefan Rufer 
>            Priority: Minor
>         Attachments: hibernate4594-tests.zip, hibernate4594-tests.zip
>
>
> Our datasource configuration contains a hibernate.default_schema property that may not be set by the application. In this case the generated SQL (select, insert) behaves correct and does not prepend the table names with a schema names. Example:
> select project0_.id as id2_0_, project0_.name as name2_0_, project0_.version as version2_0_ from Project project0_ where project0_.id=?
> However, SchemaExport does prepend the table name with the unresolved property name instead of omitting it if not available:
> 2009-11-18 22:38:24,263 | main            | ERROR | SchemaExport                   | Unsuccessful: create table ${hibernate.default_schema}.Person (id varchar(255) not null, name varchar(255), primary key (id))
> In my oppinion the behaviour should be consistent and I tend to say that the SchemaExport is wrong. If the property for the default schema is unresolved it must not be used altogether. 
> As an illustration a snip from our Spring config:
>   <bean
>     class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
>     <property name="location"
>       value="classpath:my.properties" />
>     <!-- this means I can omit properties used below -->
>     <property name="ignoreUnresolvablePlaceholders" value="true" />
>   </bean>
>   <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
>     <property name="dataSource" ref="dataSource" />
>     <property name="loadTimeWeaver">
>       <bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />
>     </property>
>     <property name="jpaPropertyMap">
>       <map>
>         <entry key="hibernate.dialect" value="${hibernate.dialect}" />
>         <entry key="hibernate.show_sql" value="${hibernate.show_sql}" />
>         <entry key="hibernate.hbm2ddl.auto" value="${hibernate.hbm2ddl.auto}" />
>         <entry key="hibernate.format_sql" value="${hibernate.format_sql}" />
>         <entry key="hibernate.generate_statistics" value="${hibernate.generate_statistics}" />
>         <entry key="hibernate.use_sql_comments" value="${hibernate.use_sql_comments}" />
>         <entry key="hibernate.default_batch_fetch_size" value="${hibernate.default_batch_fetch_size}" />
>         <entry key="hibernate.cache.provider_class" value="${hibernate.cache.provider_class}" />
>         <entry key="hibernate.cache.use_second_level_cache" value="${hibernate.cache.use_second_level_cache}" />
>         <entry key="hibernate.default_schema" value="${hibernate.default_schema}" />
>       </map>
>     </property>
>     <property name="persistenceUnitName" value="${jpa.persistenceUnitName}" />
>   </bean>
> my.properties:
> jpa.persistenceUnitName=default
> hibernate.show_sql=false
> hibernate.format_sql=false
> hibernate.use_sql_comments=false
> hibernate.hbm2ddl.auto=false
> hibernate.generate_statistics=false
> hibernate.default_batch_fetch_size=16
> hibernate.cache.provider_class=net.sf.ehcache.hibernate.EhCacheProvider
> hibernate.cache.use_second_level_cache=true
> # hibernate.default_schema not defined for the standard case. only define it if needed.

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