JPA classes manually managed

This commit is contained in:
Fabio Sinibaldi 2020-10-26 12:12:43 +01:00
parent 89ff09e630
commit 14ac05ea6c
1 changed files with 136 additions and 117 deletions

View File

@ -5,6 +5,7 @@ import java.io.UncheckedIOException;
import java.net.URL; import java.net.URL;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -148,16 +149,16 @@ public abstract class AbstractRecordManager<T extends Record> {
log.trace("Committing record "+theRecord+" Publish is "+publish); log.trace("Committing record "+theRecord+" Publish is "+publish);
if (publish) validate(); if (publish) validate();
// storeInfo(); // storeInfo();
log.debug("Record is valid, storing changed content"); log.debug("Record is valid, storing changed content");
contentHandler.storeChanges(publish); contentHandler.storeChanges(publish);
// storeInfo(); // storeInfo();
if(publish) { if(publish) {
log.debug("Registering centroid of "+theRecord); log.debug("Registering centroid of "+theRecord);
registerCentroid(); registerCentroid();
// storeInfo(); // storeInfo();
} }
transaction.commit(); transaction.commit();
@ -216,6 +217,24 @@ public abstract class AbstractRecordManager<T extends Record> {
//*********** PERSISTENCE //*********** PERSISTENCE
private static PersistenceUnitInfo archiverPersistenceUnitInfo() { private static PersistenceUnitInfo archiverPersistenceUnitInfo() {
final List<String> MANAGED_CLASSES=Arrays.asList(new String[] {
"org.gcube.application.geoportal.model.Record",
"org.gcube.application.geoportal.model.concessioni.Concessione",
"org.gcube.application.geoportal.model.concessioni.LayerConcessione",
"org.gcube.application.geoportal.model.concessioni.RelazioneScavo",
"org.gcube.application.geoportal.model.content.AssociatedContent",
"org.gcube.application.geoportal.model.content.GeoServerContent",
"org.gcube.application.geoportal.model.content.OtherContent",
"org.gcube.application.geoportal.model.content.PersistedContent",
"org.gcube.application.geoportal.model.content.UploadedImage",
"org.gcube.application.geoportal.model.content.WorkspaceContent",
"org.gcube.application.geoportal.model.gis.ShapeFileLayerDescriptor",
"org.gcube.application.geoportal.model.gis.SDILayerDescriptor"});
return new PersistenceUnitInfo() { return new PersistenceUnitInfo() {
@Override @Override
public String getPersistenceUnitName() { public String getPersistenceUnitName() {
@ -265,12 +284,12 @@ public abstract class AbstractRecordManager<T extends Record> {
@Override @Override
public List<String> getManagedClassNames() { public List<String> getManagedClassNames() {
return Collections.emptyList(); return MANAGED_CLASSES;
} }
@Override @Override
public boolean excludeUnlistedClasses() { public boolean excludeUnlistedClasses() {
return false; return true;
} }
@Override @Override