I load the objects with my own adopted query.
public List<Auftrag> getAuftragsliste(Auftragsfilter auftragsfilter) throws
HermesRuntimeException{
List<Auftrag> listeauftraege=new LinkedList<Auftrag>();
// ..... build my query
try{
Query query =em.createQuery(abfrage.toString());
// fill my placeholder
for (Map.Entry<String, Object> s :
filtermap.entrySet()) {
query.setParameter(s.getKey(),
s.getValue());
System.out.println(s.getKey() + " " +
s.getValue());
}
for(Map.Entry<String, Date> s :
filterdatum.entrySet() ){
query.setParameter(s.getKey(), s.getValue(),
TemporalType.DATE);
}
List resultList = query.getResultList();
listeauftraege.addAll(resultList);
}
catch(IllegalArgumentException e){
e.printStackTrace();
throw new
HermesRuntimeException("AuftragsverwaltungBean/getAuftragslliste:
Auragsliste konnte nicht geladen werden, da Query ungültig");
}
return listeauftraege;
}
Yes, WAS61 with FixPack
this is the code for my update:
public void updateAuftrag(Auftrag auftrag) throws HermesRuntimeException {
// begin-user-code
try {
Auftrag a=em.merge(auftrag);
em.flush();
} catch (Exception e) {
e.printStackTrace();
throw new HermesRuntimeException(
"AuftragsverwaltungBean/updateAuftrag: Auftrag
konnte nicht aktualisiert werden");
}
// end-user-code
}
the updates, where I change the value to an other value are
successfull...,except the changes to null
Rick Curtis wrote:
>
> How did you load an Object from the database? You are running WAS6, is
> that WAS61 with the FP? A code snippet may help.
>
> If you use OpenJPA APIs to load data from your database, you shouldn't
> need to call merge on that object. Is it possible that your transaction
> isn't being committed and that is why your changes aren't being persisted?
>
> -Rick
>
>
>
> Gerlex wrote:
>>
>> Hello together,
>>
>> I have one big problem!!!
>>
>> I want to update an Persistent-Entity with the merge-method and it
>> doesn't update the attributes,
>> which I have set to null.
>>
>> For example:
>>
>> 1. I load one Object from the database
>> 2. I set one attribute for example the date or a String to null
>> 3. I merge this object
>> 4. The database doesn't update the date
>>
>> When I load this object again, there is the same date than before.
>>
>> the attributes are nullable
>>
>>
>> The Environment:
>>
>> Websphere 6
>> Database DB2
>>
>>
>>
>>
>>
>>
>>
>
>
--
View this message in context:
http://n2.nabble.com/Problem-with-merge-tp2353521p2353921.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.