Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hi,
In Sirket table we have 3 field which makes primary key;
Code:
id (int)
basTar (date)
bitTar (date)
so we make extra class which name is SirketPk with annotation @Embeddable.
Our aim is to update basTar or birTar fields which are composite keys. Below code doesn't work; nothing changed. We can write extra hql code; but are there any other way to achieve this.
code is be
Hibernate version: Hibernate annotation 3.2.0 CR1
Mapping documents:Code between sessionFactory.openSession() and session.close(): Code:
SirketDAO sdao = new SirketDAO();
Calendar c1 = Calendar.getInstance();
c1.set(2004,00,01,0,0,0);
Calendar c2 = Calendar.getInstance();
c2.set(2006,3,18,0,0,0);
Calendar c3 = Calendar.getInstance();
c3.set(2006,8,17,0,0,0);
Sirket sirket = sdao.getSirket(1,c1, c2 );
sirket.getPrimaryKeys().setBasTarih(c3);
sdao.save(sirket);
HibernateSession.commitTransaction();
HibernateSession.closeSession();
Full stack trace of any exception that occurs:
Nothing changes in db
Name and version of the database you are using:
database server version: 5.0.18-nt
The generated SQL (show_sql=true):
Hibernate: select sirket0_.id as id7_0_, sirket0_.basTarih as basTarih7_0_, sirket0_.sonTarih as sonTarih7_0_, sirket0_.unvan as unvan7_0_, sirket0_.adres as adres7_0_ from Sirket sirket0_ where sirket0_.id=? and sirket0_.basTarih=? and sirket0_.sonTarih=?
Debug level Hibernate log excerpt: