hibernate - nezmyselny update

Rastislav Siekel siekel na prosoft.sk
Čtvrtek Duben 29 15:07:18 CEST 2010


Malo by pomôct( nastavit( *dynamic-insert="true"* a *dynamic-update="true"*.

Nejako takto:
*<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
         "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
         "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="xx.yy.Zzz" table="xyz" dynamic-insert="true" 
dynamic-update="true">
...
*
Rastislav "Bedo" Siekel


------------------------------------------------------------------------
Ing. Rastislav Siekel
Prosoft s.r.o., Kuzmányho 8, 010 01 Z(ilina, Slovakia
E-mail : <siekel na prosoft.sk> <mailto:siekel na prosoft.sk>
Tel : 041/562 54 91
Fax : 041/562 54 97
Mobil : 0905 34 00 20

On 29. 4. 2010 15:07, Dusan Zatkovsky wrote:
> Ahoj.
>
> Sorry ze zase otravujem, ale toto mi vrta v hlave:
>
>         EntityManagerFactory fact =
> Persistence.createEntityManagerFactory("testPU");
>
>          EntityManager m = fact.createEntityManager();
>          m.getTransaction().begin();
>
>          E e1 = new E();
>          e1.setA("a");
>          e1.setB("b");
>          e1.setC("c");
>          e1.setD("d");
>          m.persist(e1);
>
>          m.getTransaction().commit();
>
> //:: vola "insert into E (id, a, b, c, d) values (null, ?, ?, ?, ?)"
>
>          m.getTransaction().begin();
>
>          e1.setB("2");
>          //m.merge(e1);
>
>          m.getTransaction().commit();
>
> //:: vola  "update E set a=?, b=?, c=?, d=? where id=?"
>
>          m.close();
>
> Ten update je kravina, preco nevola jednoducho
> "update E set b=? where id=?"
>
> Zle som niekde nieco nastavil?
>
> Diky
>
>    
------------- dal?í ?ást ---------------
HTML p?íloha byla odstran?na...
URL: <http://amaio.cz/pipermail/konference/attachments/20100429/1deffcd4/attachment.htm>


Další informace o konferenci Konference