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.  [ 2 posts ] 
Author Message
 Post subject: Problem with creating schema
PostPosted: Fri Sep 03, 2010 7:00 am 
Newbie

Joined: Fri Sep 03, 2010 6:45 am
Posts: 2
Hi guys,

I'm a newbie. There is something goes wrong in my hibernate configuration, I think. Simply the database isn't created.
When I make a query, hibernate tell me that the relative table doesn't exist

Code:
12:43:10,828 ERROR JDBCExceptionReporter:101 - Table 'geoip.country' doesn't exist
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3494)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1960)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2114)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2696)
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2105)
        at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2264)
        at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
        at org.hibernate.loader.Loader.getResultSet(Loader.java:1869)
        at org.hibernate.loader.Loader.doQuery(Loader.java:718)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
        at org.hibernate.loader.Loader.doList(Loader.java:2449)
        ... 16 more


This is my config file:

Code:
<hibernate-configuration>

  <session-factory>

    <!-- Database connection settings -->
    <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="connection.url">jdbc:mysql://localhost:3306/geoip</property>
    <property name="connection.username">root</property>
    <property name="connection.password">root</property>

    <!-- JDBC connection pool (use the built-in) -->
    <property name="connection.pool_size">1</property>

    <!-- SQL dialect -->
    <property name="dialect">org.hibernate.dialect.HSQLDialect</property>

    <!-- Enable Hibernate's automatic session context management -->
    <property name="current_session_context_class">thread</property>

    <!-- Disable the second-level cache  -->
    <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

    <!-- Echo all executed SQL to stdout -->
    <property name="show_sql">true</property>

    <!-- Drop and re-create the database schema on startup -->
    <property name="hbm2ddl.auto">update</property>

    <mapping resource="it/nealab/geoip/model/City.hbm.xml"/>
    <mapping resource="it/nealab/geoip/model/Country.hbm.xml"/>
    <mapping resource="it/nealab/geoip/model/Ip.hbm.xml"/>
    <mapping resource="it/nealab/geoip/model/Location.hbm.xml"/>
    <mapping resource="it/nealab/geoip/model/Region.hbm.xml"/>

  </session-factory>

</hibernate-configuration>


Someone can help me please???

Thanks in advance ;)


Top
 Profile  
 
 Post subject: Re: Problem with creating schema
PostPosted: Fri Sep 03, 2010 11:11 am 
Beginner
Beginner

Joined: Fri Nov 13, 2009 4:05 pm
Posts: 30
First, you mention that the database isn't created; does this imply that the database wasn't created by you prior to actually starting your hibernate application? I could be mistaken but I do not believe that Hibernate can actually perform

CREATE DATABASE geoip;

This operation is up to you or your database administrator to make sure that the actual database is setup, configured and ready for connections. All hibernate will do from that point is create the objects in the datastore based on your files.

Can you confirm that your GEOIP database actually exists?


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

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.