Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4601574
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:50:45+00:00 2026-05-21T23:50:45+00:00

I’m trying to setup a simple hibernate + maven project. I’m following steps as

  • 0

I’m trying to setup a simple hibernate + maven project. I’m following steps as mentioned in Chapter 2 of Java presistence with hibernate (only diff is I’m maven using instead of Ant). However, while trying to generate the schema with maven hibernate 3 plugin, it seems like it is not able to create the required tables.

Code & Resources

POM.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.gs.bce</groupId>
  <artifactId>SpringExample</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
  <properties>
    <maven.compiler.source>1.6</maven.compiler.source>
    <maven.compiler.target>1.6</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  
  
  <dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>3.0.5.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>3.0.5.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>3.0.5.RELEASE</version>
    </dependency>
  
    <dependency>
        <groupId>org.hsqldb</groupId>
        <artifactId>hsqldb</artifactId>
        <version>2.0.0</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-c3p0</artifactId>
        <version>3.3.2.GA</version>
    
    </dependency>
    



    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.5.8</version>
    </dependency>
    <dependency>
        <groupId>javassist</groupId>
        <artifactId>javassist</artifactId>
        <version>3.12.1.GA</version>
    </dependency>
  </dependencies>  
    <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>hibernate3-maven-plugin</artifactId>
        <version>2.2</version>
        
          <executions>
          <execution>
            <phase>process-classes</phase>
            <goals>
              <goal>hbm2ddl</goal>
            </goals>
          </execution>
        </executions>
        
        <configuration>
          <components>
            <component>
              <name>hbm2ddl</name>
              <implementation>jdbcconfiguration</implementation>
            </component>
            <component>
              <name>hbm2hbmxml</name>
              <outputDirectory>src/main/resources</outputDirectory>
            </component>
          </components>
          <componentProperties>
            <drop>true</drop>
            <configurationfile>/src/main/resources/hibernate.cfg.xml</configurationfile>
               <outputfilename>schema.sql</outputfilename>
          </componentProperties>
        </configuration>
         <dependencies>
            <dependency>
        <groupId>org.hsqldb</groupId>
        <artifactId>hsqldb</artifactId>
        <version>2.0.0</version>
    </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>
</project>

`

Output log

Output of my mainclass, where it is trying to access MESSAGES table (as mentioned in book).

18:27:34,357DEBUG SQL:111 - 
    select
        max(MESSAGE_ID) 
    from
        MESSAGES Hibernate: 
    select
        max(MESSAGE_ID) 
    from
        MESSAGES 18:27:34,363DEBUG JDBCExceptionReporter:92 - could not fetch initial value for increment generator [select max(MESSAGE_ID) from MESSAGES] java.sql.SQLException: user lacks privilege or object not found: MESSAGES

Processing output

Output for process-classes goal

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building SpringExample 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ SpringExample ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ SpringExample ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] >>> hibernate3-maven-plugin:2.2:hbm2ddl (default) @ SpringExample >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ SpringExample ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] 
[INFO] <<< hibernate3-maven-plugin:2.2:hbm2ddl (default) @ SpringExample <<<
[INFO] 
[INFO] --- hibernate3-maven-plugin:2.2:hbm2ddl (default) @ SpringExample ---
18:30:54,300  INFO org.hibernate.cfg.Environment - Hibernate 3.3.1.GA
18:30:54,304  INFO org.hibernate.cfg.Environment - hibernate.properties not found
18:30:54,306  INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
18:30:54,308  INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
18:30:54,346  INFO org.hibernate.cfg.Configuration - configuring from url: file:/F:/workspace/SpringExample/src/main/resources/hibernate.cfg.xml
[INFO] Configuration XML file loaded: file:/F:/workspace/SpringExample/src/main/resources/hibernate.cfg.xml
18:30:54,475  INFO org.hibernate.cfg.JDBCMetaDataConfiguration - Ignoring null mapping
18:30:54,475  INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
[INFO] No hibernate properties file loaded.
18:30:54,489  INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
18:30:54,490  INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 20
18:30:54,490  INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
18:30:54,495  INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:hsql://localhost
18:30:54,495  INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=sa}
18:30:54,685  INFO org.hibernate.cfg.SettingsFactory - RDBMS: HSQL Database Engine, version: 2.0.0
18:30:54,685  INFO org.hibernate.cfg.SettingsFactory - JDBC driver: HSQL Database Engine Driver, version: 2.0.0
18:30:54,716  INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.HSQLDialect
18:30:54,745  INFO org.hibernate.transaction.TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions)
18:30:54,746  INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
18:30:54,746  INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
18:30:54,746  INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
18:30:54,746  INFO org.hibernate.cfg.SettingsFactory - JDBC batch size: 15
18:30:54,746  INFO org.hibernate.cfg.SettingsFactory - JDBC batch updates for versioned data: disabled
18:30:54,747  INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled
18:30:54,747  INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): enabled
18:30:54,747  INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto
18:30:54,747  INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
18:30:54,747  INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
18:30:54,747  INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
18:30:54,747  INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled
18:30:54,747  INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
18:30:54,748  INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
18:30:54,749  INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
18:30:54,749  INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled
18:30:54,749  INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
18:30:54,749  INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
18:30:54,749  INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
18:30:54,749  INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
18:30:54,749  INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
18:30:54,751  INFO org.hibernate.cfg.SettingsFactory - Echoing all SQL to stdout
18:30:54,752  INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled
18:30:54,752  INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
18:30:54,752  INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
18:30:54,753  INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled
18:30:54,765 DEBUG org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect - getTables(null.null.null)
18:30:54,767  INFO org.hibernate.connection.DriverManagerConnectionProvider - cleaning up connection pool: jdbc:hsqldb:hsql://localhost
18:30:54,773  INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.HSQLDialect
18:30:54,777  INFO org.hibernate.tool.hbm2ddl.SchemaExport - Running hbm2ddl schema export
18:30:54,778  INFO org.hibernate.tool.hbm2ddl.SchemaExport - writing generated schema to file: F:\workspace\SpringExample\target\hibernate3\sql\schema.sql
18:30:54,778  INFO org.hibernate.tool.hbm2ddl.SchemaExport - exporting generated schema to database
18:30:54,779  INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
18:30:54,779  INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 20
18:30:54,779  INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
18:30:54,779  INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: org.hsqldb.jdbcDriver at URL: jdbc:hsqldb:hsql://localhost
18:30:54,779  INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=sa}
18:30:54,883  INFO org.hibernate.tool.hbm2ddl.SchemaExport - schema export complete
18:30:54,885  INFO org.hibernate.connection.DriverManagerConnectionProvider - cleaning up connection pool: jdbc:hsqldb:hsql://localhost
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.675s
[INFO] Finished at: Sat May 07 18:30:54 IST 2011
[INFO] Final Memory: 5M/47M
[INFO] ------------------------------------------------------------------------
18:30:54,988  INFO org.hibernate.connection.DriverManagerConnectionProvider - cleaning up connection pool: jdbc:hsqldb:hsql://localhost

Hibernate configuration

My hibernate.cfg.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration SYSTEM
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">
org.hsqldb.jdbcDriver
</property>
<property name="hibernate.connection.url">
jdbc:hsqldb:hsql://localhost
</property>
<property name="hibernate.connection.username">
sa
</property>

<!-- <property name="hibernate.connection.username">
bceuser123
</property> -->


<property name="hibernate.dialect">
org.hibernate.dialect.HSQLDialect
</property>
<!-- Use the C3P0 connection pool provider -->
<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.timeout">300</property>
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.c3p0.idle_test_period">3000</property>
<!-- Show and print nice SQL on stdout -->
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<!-- List of XML mapping files -->
<mapping resource="hello/Message.hbm.xml"/>
</session-factory>
</hibernate-configuration>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T23:50:46+00:00Added an answer on May 21, 2026 at 11:50 pm

    I think the problem with the the DDL creation is that it cannot find the hibernate configuration file. Try removing the leading slash on the path in the pom file. So the line should read like:

    <configurationfile>src/main/resources/hibernate.cfg.xml</configurationfile>
    

    To automatically create the DB add the following property to your hiberante.cfg.xml

    <property name="hibernate.hbm2ddl.auto">create</property>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.