-->
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.  [ 1 post ] 
Author Message
 Post subject: hbm2ddl.auto won't create table unless using JDBC
PostPosted: Wed Mar 23, 2011 11:35 pm 
Newbie

Joined: Wed Mar 23, 2011 11:30 pm
Posts: 1
I've recently changed from using a direct JDBC connection to using a JBoss MySQL data souce on my configuration file. Despite having the hbm2ddl.auto="update" config on my hibernate.cfg.xml file the mapped tables (I'm using mapping xml files) are not generated automatically.

Once I switch back to a direct JDBC connection the tables are generated automatically. Am I missing something? I'd like to get the automatic table generation while using a data source.

Here's the relevant extract of my hibernate config.
Code:
<property name="connection.datasource">java:/MySqlDS</property>
 
  <!--  JDBC CONNECTION POOL -->
  <property name="hibernate.connection.pool_size">10</property>
 
  <!-- ECHO ALL EXECUTED SQL -->
  <property name="show_sql">true</property>
 
  <!-- SQL DIALECT -->
  <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
 
  <!-- Enable Hibernate's automatic session context management -->
  <property name="current_session_context_class">jta</property>
 
  <!-- OTHER SETTINGS available options are: validate | update | create | create-drop -->
  <property name="hibernate.hbm2ddl.auto">update</property>


Here is my datasource extract:
Code:
<local-tx-datasource>
    <jndi-name>MySqlDS</jndi-name>
    <connection-url>jdbc:mysql://(insert ip address)/test</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>user</user-name>
    <password>pw</password>
    <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>


N.B. The above are only extracts, I've omitted irrelevant details. But I can assure you that they're just the basic setup from the documentations.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.