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.  [ 1 post ] 
Author Message
 Post subject: @Embeddable, primary key update
PostPosted: Wed May 31, 2006 8:58 am 
Newbie

Joined: Wed May 31, 2006 8:41 am
Posts: 2
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:


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.