[Persistence, JBoss/CMP, Hibernate, Database] - Generate XML from an entity
by poyge394
Hi,
In my application i generate an xml file from entity beans,
before i run
manger.persist(entity);
my generated xml looks like:
| <rollingstock>
| <rollingstockId>0</rollingstockId>
| <route>Stockholm</route>
| <nextRoute>Uppsala</nextRoute>
| <schedule>
| <id>0</id>
| <destination>destination</destination>
| </schedule>
| <vehicles>
| <vehicle>
| <id>0</id>
| <vehicleId>1412</vehicleId>
| <litt>litt</litt>
| <ticketId>1412</ticketId>
| <vehicleType>vehicleType</vehicleType>
| <weight>
| <weight>78.0</weight>
| </weight>
| <dynamicWeight>
| <weight>78.0</weight>
| </dynamicWeight>
| <brakeWeight>
| <weight>110.0</weight>
| </brakeWeight>
| <length>
| <length>155.3</length>
| <unit>M</unit>
| </length>
| <nrOfAxles>4</nrOfAxles>
| <speed>
| <speed>160.0</speed>
| <unit>s</unit>
| </speed>
| <service>PULLING</service>
| <canDoorsBeLocked>true</canDoorsBeLocked>
| <phoneNumbers>
| <phonenumber>
| <id>0</id>
| <location>Ahytt</location>
| <number>0148782373</number>
| </phonenumber>
| </phoneNumbers>
| <passengerCarConfiguration>
| <id>0</id>
| <class1>10</class1>
| <class2>10</class2>
| <couchette>5</couchette>
| <compartments>10</compartments>
| </passengerCarConfiguration>
| <comments>
| <comment>
| <id>0</id>
| <comment>Comment about this vihicle</comment>
| </comment>
| </comments>
| <nextAssignment>9010</nextAssignment>
| <schedule reference="../../../schedule"/>
| <nextSchedule reference="../../../schedule"/>
| <positionInTrainAssembly>0</positionInTrainAssembly>
| </vehicle>
| </vehicles>
| </rollingstock>
|
After:
| <rollingstock>
| <rollingstockId>4200</rollingstockId>
| <route>Stockholm</route>
| <nextRoute>Uppsala</nextRoute>
| <schedule>
| <id>4200</id>
| <destination>destination</destination>
| </schedule>
| <vehicles class="org.hibernate.collection.PersistentBag">
| <bag>
| <vehicle>
| <id>3700</id>
| <vehicleId>1412</vehicleId>
| <litt>litt</litt>
| <ticketId>1412</ticketId>
| <vehicleType>vehicleType</vehicleType>
| <weight>
| <weight>78.0</weight>
| </weight>
| <dynamicWeight>
| <weight>78.0</weight>
| </dynamicWeight>
| <brakeWeight>
| <weight>110.0</weight>
| </brakeWeight>
| <length>
| <length>155.3</length>
| <unit>M</unit>
| </length>
| <nrOfAxles>4</nrOfAxles>
| <speed>
| <speed>160.0</speed>
| <unit>s</unit>
| </speed>
| <service>PULLING</service>
| <canDoorsBeLocked>true</canDoorsBeLocked>
| <phoneNumbers class="org.hibernate.collection.PersistentSet">
| <set>
| <phonenumber>
| <id>3600</id>
| <location>Ahytt</location>
| <number>0148782373</number>
| </phonenumber>
| </set>
| <initialized>true</initialized>
| <cachedSize>-1</cachedSize>
| <dirty>false</dirty>
| <storedSnapshot class="map">
| <entry>
| <phonenumber reference="../../../set/phonenumber"/>
| <phonenumber reference="../../../set/phonenumber"/>
| </entry>
| </storedSnapshot>
| </phoneNumbers>
| <passengerCarConfiguration>
| <id>3600</id>
| <class1>10</class1>
| <class2>10</class2>
| <couchette>5</couchette>
| <compartments>10</compartments>
| </passengerCarConfiguration>
| <comments class="org.hibernate.collection.PersistentSet">
| <set>
| <comment>
| <id>3600</id>
| <comment>Comment about this vihicle</comment>
| </comment>
| </set>
| <initialized>true</initialized>
| <cachedSize>-1</cachedSize>
| <dirty>false</dirty>
| <storedSnapshot class="map">
| <entry>
| <comment reference="../../../set/comment"/>
| <comment reference="../../../set/comment"/>
| </entry>
| </storedSnapshot>
| </comments>
| <nextAssignment>9010</nextAssignment>
| <schedule reference="../../../../schedule"/>
| <nextSchedule reference="../../../../schedule"/>
| <positionInTrainAssembly>0</positionInTrainAssembly>
| </vehicle>
| </bag>
| <initialized>true</initialized>
| <cachedSize>-1</cachedSize>
| <dirty>false</dirty>
| <storedSnapshot class="list">
| <vehicle reference="../../bag/vehicle"/>
| </storedSnapshot>
| </vehicles>
| </rollingstock>
|
|
as you see hibernate add hibernate specific information to the POJO as:
| <initialized>true</initialized>
| <cachedSize>-1</cachedSize>
| <dirty>false</dirty>
| <storedSnapshot class="list">
| <vehicle reference="../../bag/vehicle"/>
| </storedSnapshot>
|
is it possible to get an xml as it look like before the manager.persist call.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049334#4049334
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049334
18 years, 10 months
[Installation, Configuration & Deployment] - Re: Transaction changes foiled me
by camunda
Any ideas to that issue? I encountered the same problem, I have a JTA environment with jbpm 3.2 (works with Hibernate) calling in a action a EJB 3 SessionBean with creates a EJB 3 Entity Bean.
I am not sure whats the problem, the second transaction should just join the first one. The log says:
| 2007-05-29 14:22:31,656 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 4835087776382976
| 2007-05-29 14:22:31,656 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] Looking for a JTA transaction to join
| 2007-05-29 14:22:31,656 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization
| 2007-05-29 14:22:31,656 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] Looking for a JTA transaction to join
| 2007-05-29 14:22:31,656 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] Transaction already joined
| 2007-05-29 14:22:31,656 DEBUG [org.hibernate.event.def.AbstractSaveEventListener] executing identity-insert immediately
| 2007-05-29 14:22:31,656 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 5)
| 2007-05-29 14:22:31,656 DEBUG [org.hibernate.jdbc.ConnectionManager] opening JDBC connection
| 2007-05-29 14:22:31,656 WARN [com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.transaction.arjunacore.enliststarterror] [com.arjuna.ats.internal.jta.transaction.arjunacore.enliststarterror] TransactionImple.enlistResource - XAResource.start returned: XAException.XAER_PROTO for < 131075, 28, 26, 1--3f57fa2e:f5d:465c0789:125-3f57fa2e:f5d:465c0789:12f >
| 2007-05-29 14:22:31,656 ERROR [STDERR] org.jboss.resource.connectionmanager.JBossLocalXAException: Trying to start a new tx when old is not complete! old: < 131075, 28, 26, 1--3f57fa2e:f5d:465c0789:101-3f57fa2e:f5d:465c0789:10b >, new < 131075, 28, 26, 1--3f57fa2e:f5d:465c0789:125-3f57fa2e:f5d:465c0789:12f >, flags 0
| 2007-05-29 14:22:31,656 ERROR [STDERR] at org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource.start(TxConnectionManager.java:886)
| 2007-05-29 14:22:31,656 ERROR [STDERR] at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:701)
| 2007-05-29 14:22:31,656 ERROR [STDERR] at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:446)
| 2007-05-29 14:22:31,656 ERROR [STDERR] at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener$TransactionSynchronization.enlist(TxConnectionManager.java:773)
| 2007-05-29 14:22:31,656 ERROR [STDERR] at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:564)
| 2007-05-29 14:22:31,656 ERROR [STDERR] at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnectionManager.java:337)
| 2007-05-29 14:22:31,656 ERROR [STDERR] at org.jboss.resource.connectionmanager.BaseConnectionManager2.reconnectManagedConnection(BaseConnectionManager2.java:518)
| 2007-05-29 14:22:31,656 ERROR [STDERR] at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:399)
| 2007-05-29 14:22:31,656 ERROR [STDERR] at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
| 2007-05-29 14:22:31,656 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:47)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:94)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.prepare(IdentityGenerator.java:69)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:30)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2158)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2638)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManager.persist(TransactionScopedEntityManager.java:182)
| 2007-05-29 14:22:31,671 ERROR [STDERR] at com.camunda.jmgui.business.OrderServiceBean.createOrder(OrderServiceBean.java:26)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049330#4049330
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049330
18 years, 10 months
[JBoss jBPM] - Re: multiple jobexecutor threads?
by estaub
Alex,
If you search for "StaleObjectStateException", you'll see other instances on this forum where it occurs after a fork. I don't know if it has the same cause as yours, because you didn't report any details about what you're doing. Unfortunately, no one bothered to follow up with a resolution or workaround, if one was found.
Also, see http://jira.jboss.com/jira/browse/JBPM-626. I'm not sure if it's relevant. It's reported in enough detail that you can probably tell. But again, unfortunately, no resolution or workaround was reported, if found.
I suggest that you prove to yourself that when your async events kick off, you're picking up the different node instances - not accidentally grabbing the same node instance, somehow.
Beyond that, sorry, I got nuthin'.
Please report what you find - this will be my problem soon, too!
-Ed Staub
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049324#4049324
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049324
18 years, 10 months