Hi,
generic question here.
I am trying to import all data from a previous CUBA app. Have slight model changes so need to get around them pretty much manually. I proceed by creating a JMX class and calling @ManagedOperations through the interface.
My question is that currently when I run the import I use the following procedure:
a. read the source table such as “select * from tableA” corresponding tableA to the instances of entity A
b. traverse it via a java.sql.ResultSet
c. dataManager.create(newAInstance.class) and store it in a temp arraylist filled with the new entities
d. when I finish traversing the table I call dataManager.save(newEntitiesArray)
and that’s it
However it would save some job to use the following logic
a. read the source table such as “select * from tableA” corresponding tableA to the instances of entity A
b. traverse it via a java.sql.ResultSet
c. dataContext.create(newAInstance.class) (not using any array since instances are tracked by dataContext)
d. when I finish traversing the table I call dataContext.commit() and dataContext.clear()
and then go one with the next table…
In this latter way I wouldn’t need to manage the array holding the entities.
However I am not able to recreate the injected components in my JMX class. Is there any way to do so or would have to set up too many artifacts, being at the end a better approach to maintain the array of entities and then saving them via dataManager.
Hope my explanation was clear enough.
Thanks for any insights.
Regards,
Carlos.