-->
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.  [ 3 posts ] 
Author Message
 Post subject: Can't save data in database
PostPosted: Wed Aug 31, 2005 8:32 am 
Newbie

Joined: Tue Aug 09, 2005 1:42 am
Posts: 8
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:Hibernate3.0

[b]Mapping documents:

[b]Code between sessionFactory.openSession() and session.close():

SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy");
Configuration cfg=new Configuration();
cfg.configure(new File(System.getProperties().getProperty("sun.boot.library.path")+"\\hibernate.cfg.xml"));
SessionFactory sessionFactory=cfg.buildSessionFactory();
Tb_VoucherMain tb_vm=new Tb_VoucherMain(vMain.elementAt(0).toString(),formatter.parse(vMain.elementAt(1).toString()),vMain.elementAt(2).toString(),Double.parseDouble(vMain.elementAt(3).toString()),Double.parseDouble(vMain.elementAt(4).toString()),vMain.elementAt(5).toString());
Tb_VoucherDetail tb_vd=new Tb_VoucherDetail(vDetail.elementAt(4).toString(),vDetail.elementAt(0).toString(),Double.parseDouble(vDetail.elementAt(2).toString()),Double.parseDouble(vDetail.elementAt(3).toString()));
Session session=sessionFactory.openSession();
Transaction tx=session.beginTransaction();
session.save(tb_vm);
session.save(tb_vd);
tx.commit();
session.flush();
session.close();
Full stack trace of any exception that occurs:
No Exception.
Name and version of the database you are using:
MSSQLServer
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 8:35 am 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
Can you show your mapping files ?

Make sure that unless you're using assigned id generation, your id fields are null.

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 31, 2005 10:55 am 
Regular
Regular

Joined: Mon Aug 29, 2005 9:46 am
Posts: 102
I'd advise you to post your code between
Code:
and
tags, so it will be easier to understand and to help. See ya.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.