Hi,
Our application uses a sharding strategy with ObjectDB. We have numerous ODB files with different schemas managed by the same ObjectDB server that are sharded based on the day. We let ObjectdDB create the schema in each ODB file the first time objects are persisted. The problem is that when a process runs that querys a shard before the schema is created a generic PersistenceException is thrown. For us, and I assume many other users, this isn’t a problem and we would like our application to behave like the query returned nothing. We can’t implement this behavior in our application without parsing the exception text. It would be very nice if this particular exception were a type/subclass of PersistenceException that we can catch and handle differently than more critical PersistenceExceptions.
Please consider this suggestion and let me know if this is something that can be done or if you have alternative solutions to the problem.
Thank you,
Clinton Moore
com.adheris.cap.summaryframework.entities.daos.SummaryArchiveDAO:206 -> Query failed due to
TEX: Type AbstractClientSummary is not found
com.objectdb.o._PersistenceException:45
com.objectdb.o.JPE:145
com.objectdb.o.ERR:56
com.objectdb.o.OBC:1503
com.objectdb.jpa.JpaQuery:725
com.adheris.cap.summaryframework.entities.daos.SummaryArchiveDAO:204
com.adheris.cap.loggingservices.AbstractHLogService:74
One of the methods that returns this exception every day a before a new shard is created.
public List<Integer> getDistinctStores(String chain) {
List<Integer> storeList = new ArrayList<Integer>();
String queryString = "select DISTINCT(summary.store) from AbstractClientSummary summary WHERE summary.chain == :chain";
TypedQuery<Integer> query = manager.createQuery(queryString, Integer.class);
query.setParameter("chain", Integer.parseInt(chain));
try {
storeList = query.getResultList();
} catch (PersistenceException e) {
logger.error("Query failed due to {}", ExceptionAssistant.getStackTrace(e));
}