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: force load pojo after insert
PostPosted: Tue Apr 06, 2010 11:32 am 
Newbie

Joined: Tue Apr 06, 2010 11:06 am
Posts: 1
Hello,
i have a question: is it possible reload pojo after insert?
I have two pojo: the first pojo (PianificazioneCommessaLavoratoreAnno) maps a table, the second pojo (PianificazioneGlobaleCommessaAnno) has a subselect. The first pojo has a relation many-to-one (pianificazioneGlobaleCommessaAnno) with the second pojo with properties inset="false" update="false".
When i insert new pojo, the relation many-to-one is null. I want after insert, the first pojo with relation many-to-one not empty.

The first hbm:

<?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 auto-import="false">
<class name="it.eng.gecor.db.dto.PianificazioneCommessaLavoratoreAnno" table="PIANIFICAZIONE" >

<composite-id name="oid" class="it.eng.gecor.db.dto.oid.PianificazioneOid">
<key-many-to-one name="lavoratore" class="it.eng.gecor.db.dto.Lavoratore">
<column name="LAV_MATRICOLA" />
</key-many-to-one>
<key-many-to-one name="commessa" class="it.eng.gecor.db.dto.Commessa">
<column name="COM_CODICE" />
</key-many-to-one>
<key-property name="anno" type="java.lang.Integer">
<column name="ANNO" />
</key-property>
</composite-id>

<property name="mese1" type="java.math.BigDecimal" >
<column name="MESE1" not-null="false" />
</property>

<property name="mese2" type="java.math.BigDecimal">
<column name="MESE2" not-null="false" />
</property>

<property name="mese3" type="java.math.BigDecimal">
<column name="MESE3" not-null="false" />
</property>

<property name="mese4" type="java.math.BigDecimal">
<column name="MESE4" not-null="false" />
</property>

<property name="mese5" type="java.math.BigDecimal">
<column name="MESE5" not-null="false" />
</property>

<property name="mese6" type="java.math.BigDecimal">
<column name="MESE6" not-null="false" />
</property>

<property name="mese7" type="java.math.BigDecimal">
<column name="MESE7" not-null="false" />
</property>

<property name="mese8" type="java.math.BigDecimal">
<column name="MESE8" not-null="false" />
</property>

<property name="mese9" type="java.math.BigDecimal">
<column name="MESE9" not-null="false" />
</property>

<property name="mese10" type="java.math.BigDecimal">
<column name="MESE10" not-null="false" />
</property>

<property name="mese11" type="java.math.BigDecimal">
<column name="MESE11" not-null="false" />
</property>

<property name="mese12" type="java.math.BigDecimal">
<column name="MESE12" not-null="false" />
</property>

<many-to-one name="commessa" class="it.eng.gecor.db.dto.Commessa" insert="false" update="false" cascade="none">
<column name="COM_CODICE" />
</many-to-one>

<many-to-one name="lavoratore" class="it.eng.gecor.db.dto.Lavoratore" insert="false" update="false" cascade="none">
<column name="LAV_MATRICOLA" />
</many-to-one>

<many-to-one name="pianificazioneGlobaleCommessaAnno" class="it.eng.gecor.db.dto.PianificazioneGlobaleCommessaAnno" insert="false" update="false" cascade="none">
<column name="COM_CODICE" />
<column name="ANNO" />
</many-to-one>

<many-to-one name="pianificazioneGlobaleLavoratoreAnno" class="it.eng.gecor.db.dto.PianificazioneGlobaleLavoratoreAnno" insert="false" update="false" cascade="none">
<column name="LAV_MATRICOLA" />
<column name="ANNO" />
</many-to-one>

</class>
</hibernate-mapping>

the second hbm:

<hibernate-mapping auto-import="false">
<class name="it.eng.gecor.db.dto.PianificazioneGlobaleLavoratoreAnno" >

<subselect>
select
p.LAV_MATRICOLA,
p.ANNO,
sum(p.MESE1) as MESE1,
sum(p.MESE2) as MESE2,
sum(p.MESE3) as MESE3,
sum(p.MESE4) as MESE4,
sum(p.MESE5) as MESE5,
sum(p.MESE6) as MESE6,
sum(p.MESE7) as MESE7,
sum(p.MESE8) as MESE8,
sum(p.MESE9) as MESE9,
sum(p.MESE10) as MESE10,
sum(p.MESE11) as MESE11,
sum(p.MESE12) as MESE12
from PIANIFICAZIONE p
group by p.LAV_MATRICOLA,p.ANNO
</subselect>

<composite-id name="oid" class="it.eng.gecor.db.dto.oid.PianificazioneOid">
<key-many-to-one name="lavoratore" class="it.eng.gecor.db.dto.Lavoratore">
<column name="LAV_MATRICOLA" />
</key-many-to-one>
<key-property name="anno" type="java.lang.Integer">
<column name="ANNO" />
</key-property>
</composite-id>

<property name="mese1" type="java.math.BigDecimal" >
<column name="MESE1" not-null="false" />
</property>

<property name="mese2" type="java.math.BigDecimal">
<column name="MESE2" not-null="false" />
</property>

<property name="mese3" type="java.math.BigDecimal">
<column name="MESE3" not-null="false" />
</property>

<property name="mese4" type="java.math.BigDecimal">
<column name="MESE4" not-null="false" />
</property>

<property name="mese5" type="java.math.BigDecimal">
<column name="MESE5" not-null="false" />
</property>

<property name="mese6" type="java.math.BigDecimal">
<column name="MESE6" not-null="false" />
</property>

<property name="mese7" type="java.math.BigDecimal">
<column name="MESE7" not-null="false" />
</property>

<property name="mese8" type="java.math.BigDecimal">
<column name="MESE8" not-null="false" />
</property>

<property name="mese9" type="java.math.BigDecimal">
<column name="MESE9" not-null="false" />
</property>

<property name="mese10" type="java.math.BigDecimal">
<column name="MESE10" not-null="false" />
</property>

<property name="mese11" type="java.math.BigDecimal">
<column name="MESE11" not-null="false" />
</property>

<property name="mese12" type="java.math.BigDecimal">
<column name="MESE12" not-null="false" />
</property>

<many-to-one name="lavoratore" class="it.eng.gecor.db.dto.Lavoratore" insert="false" update="false" cascade="none">
<column name="LAV_MATRICOLA" />
</many-to-one>

</class>
</hibernate-mapping>

thank you
P.S: sorry for my English


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.