[Hibernate] My first Hibernate App,.. got some question, appreciate ur help

2005-02-09 Thread pkaka2

Hi everybody,

well, i thought let me try working on some example using Hibernate ORM...

I somehow made it work..
part of the code:

conn=ds.getConnection(uname,passwd);

Configuration cfg=new Configuration();
cfg.addClass(testing.Department.class);
cfg.setProperties(System.getProperties());
SessionFactory sf=cfg.buildSessionFactory();

// try without passing connection

//Session sess1=sf.openSession(); 

Session sess1=sf.openSession(conn); 
//Transaction trans=sess1.beginTransaction();

Department dept=new Department();
dept.setName(abc);dept.setCity(xyz);dept.setState(xx);
sess1.save(dept);

sess1.flush(); 
// as well as commit yourself unless using transactionsupport 
 sess1.connection().commit(); 


//trans.commit();
sess1.close();  


I get it working, only when i pass the connection like:
Session sess1=sf.openSession(conn);

if not i always get an error, saying
java.lang.UnsupportedOperationException: The user must supply a JDBC connection

So, i guess, something wrong with my hibernate.properties, i have got no clue 
where it is wrong..

this is where i am supplying the required information in hibernate.properties:



 ## JNDI Datasource 
 
 hibernate.connection.datasource jdbc/jndiname
 hibernate.connection.username user
 hibernate.connection.password passwd 
 
 ## DB2/400  
 
 hibernate.dialect net.sf.hibernate.dialect.DB2400Dialect
 
 hibernate.connection.driver_class com.ibm.as400.access.AS400JDBCDriver
 
 hibernate.connection.url jdbc:as400://systemName
 hibernate.connection.username userhibernate.connection.password passwd 


I know, people who are very comfortable with Hibernate, will definitely know 
what is going wrong..

I thank you very much for your help.. I appreciate.. :-)

I am using Websphere app server on AS400,.. DB2 included in AS400..
and since the tables are not Journaled, i commented the Transaction, which are 
not supported incase tables are not journaled,.. that is the problem with DB2 
on AS400..when i think of using Hibernate.. 










---
SF email is sponsored by - The IT Product Guide
Read honest  candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595alloc_id=14396op=click
___
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel


Re: [Hibernate] My first Hibernate App,.. got some question, appreciate ur help

2005-02-09 Thread Christian Bauer
On Feb 10, 2005, at 1:27 AM, [EMAIL PROTECTED] wrote:
well, i thought let me try working on some example using Hibernate 
ORM...
There is a user forum, this is the developer list.
--
Christian Bauer
callto://christian-bauer
Hibernate
[EMAIL PROTECTED]
http://hibernate.org
JBoss Inc
[EMAIL PROTECTED]
http://jboss.com

---
SF email is sponsored by - The IT Product Guide
Read honest  candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595alloc_id=14396op=click
___
hibernate-devel mailing list
hibernate-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hibernate-devel