Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Hibernate with Oracle 10g --help

843859Nov 17 2006 — edited Mar 17 2008
hi

MY PROJECT HAS
-------------------------------------------
EMP.JAVA(BEAN) , getters and setters id,name
EMP.HBF.XML
--------------------------------------------
create table EMP(ID varchar2(10),NAM varchar2(10),DID number)
--------------------------------------------
DEPARTMENT.JAVA(BEAN), getters and setters for did,dnam
DEP.HBF.XML
---------------------------------------------
create table EMP(DNAM varchar2(10),DID number)
---------------------------------------------
MANAGE.JAVA (main) to manage the SQL using the hibernate
HIBERNATE.CFG.XML
----------------------------------------------
actually problem that I am using many to one mapping ,were any no of emp can have one dept.i entered the values using the code(manage.java) given below
Session session =NewClass.getSessionFactory().getCurrentSession();
session.beginTransaction();
emp e = new emp();
int i = 4;
Department d = new Department();
d.setDptid(i);
System.out.println(d.getDptid());
d.setDptname("english");
e.setEid(1);
e.setEname("booom");
e.setDd(d);
session.save(d);
session.save(e);
session.getTransaction().commit();

i was able to put the values on Database ,but the ID which i am
sending not getting in the database ,,it is taking its own values
the string i put on the Database is correct only the error with the
integer i am passing

note:generator class-----native is used in xml

plz help to solve
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 14 2008
Added on Nov 17 2006
4 comments
445 views