Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

hibernate with struts

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I am developing a simple application using hibernate 3.3( using annotations),struts(1.3),eclipse(3.3),tomcat(5.5)
I have written the hibernate.cfg.xml file as below..

<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/company</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.MySQLDialect</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">none</property>
<mapping class="com.test.Employee"/>
</session-factory>
</hibernate-configuration>


I am getting an exception while runnign the program.

Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org/hibernate/engine/query/sql/NativeSQLQueryReturn

Please help me in this..It is urgent,,
Thanks
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Just looks like the runtime can't find a certain Hibernate jar file.

Where are you packaging your Hibernate JAR files? In the lib directory of the web module is one common place to put them.

At the very least, you should have these on the classpath of the classloader that creates the Hibernate Session and SessionFactory:

1. ejb3-persistence.jar
2. hibernate-commons-annotations.jar
3. hibernate-annotations.jar
4. hibernate3.jar

You also need all the libraries that these files link to.


-Cameron McKenzie
 
subha nair
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Thankxx a lot..
I reloaded all the library in the lib folder.
Now it's working.I could get the result page..

Thanksss
 
subha nair
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I am using Mysql and hibernate annotations. Below shown is Employee.java

@Entity
@Table(name = "employee")
public class Employee implements Serializable {

public Employee() {

}
@Id
@Column(name = "id")
Integer id;

@Column(name = "name")
String name;

public Integer getId() {
return id;
}

public void setId(Integer id) {
this.id = id;
}}

I have created a database in my Mysql as company.
I have not created any table in mysql. will the above code dynamically create table and the columns

I have written like this .But on submitting the values in the registration page, I am getting an error...

java.lang.RuntimeException: org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
java.sql.BatchUpdateException: Base table or view not found message from server: "Table 'company.employee' doesn't exist"

Help pleasee
 
subha nair
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Sorry I got it working..

i had previously set <property name="hbm2ddl.auto">none</property>

now I made it as <property name="hbm2ddl.auto">create</property>
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

subha nair wrote:I am developing a simple application using hibernate 3.3( using annotations),struts(1.3),eclipse(3.3),tomcat(5.5)
I have written the hibernate.cfg.xml file as below..

<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/company</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.MySQLDialect</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">none</property>
<mapping class="com.test.Employee"/>
</session-factory>
</hibernate-configuration>


I am getting an exception while runnign the program.

Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org/hibernate/engine/query/sql/NativeSQLQueryReturn

Please help me in this..It is urgent,,
Thanks

 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please do not resurrect old threads for new questions. Please start a new topic for your question.
    Bookmark Topic Watch Topic
  • New Topic