I was having a look in the JConsole at the stack of the hanging thread, I think
the issue is to do with my abstractEntity class (which all the JPA entity
objects extend) overrides the hascode with this...
public int hashCode() {
if(getId() != null)
{
return new HashCodeBuilder().append(getId()).toHashCode();
}
else
{
return HashCodeBuilder.reflectionHashCode(this);
}
When I remove this, the fromXML() works
Dale Ellis
Senior Developer
Serengeti Systems
Part of the Netcall Group
t 0330 333 7880
f 0330 333 0102
e [email protected]
a Serengeti House, Hillside Business Park, 6 Hillside Road, Bury St Edmunds,
IP32 7EA
w www.serengeti-systems.com
-----Original Message-----
From: Jörg Schaible [mailto:[email protected]]
Sent: 09 November 2013 17:29
To: [email protected]
Subject: [xstream-user] RE: RE: RE: Re: Converting an object back from XML
Hello Dale,
sorry, I was busy yesterday.
Dale Ellis wrote:
> Still can't get this working and have spent a day on it. It's
> definitely to do with the way the StageDefinition/StageTransition
> Sets, if I blank them the fromXml will work.
It's a general problem with TreeSet/TreeMap (sets use internally typically
maps). If the optimized addAll/putAll does not work, the order of every element
has to be recalculated when they are inserted. This is even worse for
deserialization frameworks, if the compareTo method accesses all kind of other
members that might have not yet been deserialized and operates therefor on
incomplete objects.
The JDK has typically an optimization if you try to put an already sorted map
into an empty one. From the stack trace below, it is visible, that the
condition for the optimization was not met, but I do not understand why.
> I'm just beaten now, so as a workaround I'm going to change this...
>
> String originalXml = parser.toXML(contentObject);
> String idPattern = "<id>(.+?)</id>";
> String xml = originalXml.replaceAll(idPattern, "");
>
> To this
>
> String originalXml = parser.toXML(contentObject);
> String idPattern = "<id>(.+?)</id>";
> String xml = originalXml.replaceAll(idPattern, "<id>-1</id>");
>
> Just going to have to write a method to loop through and null the id's
You may try to use omitField instead.
- Jörg
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email