aspose file tools*
The moose likes Object Relational Mapping and the fly likes HIbernate-UnsupportedoperationException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "HIbernate-UnsupportedoperationException" Watch "HIbernate-UnsupportedoperationException" New topic
Author

HIbernate-UnsupportedoperationException

syruss kumar
Ranch Hand

Joined: Jul 23, 2009
Posts: 93
Hi all,
I have created a simple java application with hibernate. while i am trying to execute i got this error

Exception in thread "main" java.lang.UnsupportedOperationException: The user must supply a JDBC connection

I have added these jars with my application.
1.hibernate3.jar
2.hsqldb.jar
3.jta.jar
4.commons-logging.jar
5.cglib.jar
6.commons-beanutils.jar
7.commons-collections.jar
8.commons-chain.jar
9.commons-dbcp.jar
10.odbc.jar
11.mysql-connector-java-5.0.jar
12.commons-digester.jar
13.commons-lang.jar
13.dom.jar


Can anyone help me to resolve this error.

Thanks in advance


All search starts with beginner's luck and all search ends with victor's severly tested.
syruss kumar
Ranch Hand

Joined: Jul 23, 2009
Posts: 93
This is my UserLoginDAO
code] package com.DAO;

import java.awt.List;

import javax.transaction.HeuristicMixedException;
import javax.transaction.HeuristicRollbackException;
import javax.transaction.RollbackException;
import javax.transaction.SystemException;
import javax.transaction.Transaction;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;

import com.VO.UserLogin;

public class UserLoginDAO {
configuration config;
public UserLoginDAO(){
config=configuration.getConfiguration();

}
public java.util.List getUser() {
java.util.List userList;
Session session=config.getSession();
Transaction tx=(Transaction) session.beginTransaction();
Criteria userCriteria=session.createCriteria(UserLogin.class);
userCriteria.add(Restrictions.like("username",new String("Navin")));
userList=userCriteria.list();
try {
tx.commit();
} catch (SecurityException e) {

e.printStackTrace();
} catch (IllegalStateException e) {

e.printStackTrace();
} catch (RollbackException e) {

e.printStackTrace();
} catch (HeuristicMixedException e) {

e.printStackTrace();
} catch (HeuristicRollbackException e) {

e.printStackTrace();
} catch (SystemException e) {

e.printStackTrace();
}
UserLogin user=(UserLogin) userList.get(0);
System.out.println("UserName :"+user.getUsername());
System.out.println("Password :"+user.getPassword());
return userList;

}
public static void main(String[] args) {
new UserLoginDAO().getUser();
}

}

This is my configuration class

package com.DAO;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class configuration {
private static configuration config;
private configuration(){

}
public static configuration getConfiguration(){
if(config ==null){
synchronized (configuration.class) {
if(config==null)
config=new configuration();

}
}
return config;
}

public Session getSession(){
SessionFactory factory=new Configuration().configure().buildSessionFactory();
Session session=factory.openSession();
return session;
}

}
This is my hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="Connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="Connection.Url">jdbc:mysql/192.168.0.112:3306/navin</property>
<property name="username">root</property>
<property name="password"></property>
<property name="pool_size">5</property>
<property name="showsql">true</property>

<mapping resource="com/mapping/UserLogin.hbm.xml"/>
</session-factory>
</hibernate-configuration>
[/code]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HIbernate-UnsupportedoperationException
 
Similar Threads
Sturts dataBase connection problem
Exception in example Using Hibernate Entity Manager in 2nd chapter of Java Persistence WithHibernate
Upload files from client
Hibernate 3.3.1 setup help!
exception getting while running a Hibernate program