openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lpezet <lpe...@gmail.com>
Subject Custom data store implementation guidelines
Date Tue, 07 May 2013 21:31:49 GMT
Hi!

I'm trying to understand how OpenJPA works to be able to create say a
different data store.
I created my own BrokerFactory, Store, StoreManager, StoreQuery and
ResultObjectProvider.
Right now the code is just pass-through and only logs the method being
called.

I have a simple test as well:
/Map<String, String> oProps = new HashMap<String, String>();
oProps.put("openjpa.BrokerFactory", "org.fluke.jpa.BrokerFactory");
EntityManagerFactory factory =
OpenJPAPersistence.createEntityManagerFactory("hellojpa",
"org/fluke/jpa/persistence.xml", oProps);

EntityManager em = factory.createEntityManager();
em.getTransaction().begin();
em.persist(new Message("Hello Persistence!"));
em.getTransaction().commit();
em.close();

EntityManager em2 = factory.createEntityManager();
Query q = em2.createQuery("select m from Message m");
for (Message m : (List<Message>) q.getResultList()) {
	System.out.println(m.getMessage()
		+ " (created on: " + m.getCreated() + ")"); 
}
em2.close();
factory.close();/


Here's what I get in the logs:
/
14:56:45.922 [main] ERROR o.f.jpa.StoreManager - setContext()
14:56:45.923 [main] ERROR o.f.jpa.StoreManager - newFetchConfiguration()
14:56:45.926 [main] ERROR o.f.j.StoreManager$FetchConfigurationImpl -
setContext()
14:56:45.954 [main] ERROR o.f.jpa.StoreManager - beginOptimistic()
14:56:46.031 [main] ERROR o.f.jpa.StoreManager - beforeStateChange()
14:56:46.033 [main] ERROR o.f.jpa.StoreManager - assignObjectId()
14:56:46.033 [main] ERROR o.f.jpa.StoreManager - retainConnection()
14:56:46.033 [main] ERROR o.f.jpa.StoreManager - begin()
14:56:46.037 [main] ERROR o.f.jpa.StoreManager - flush()
14:56:46.037 [main] ERROR o.f.jpa.StoreManager - commit()
14:56:46.037 [main] ERROR o.f.jpa.StoreManager - releaseConnection()
14:56:46.037 [main] ERROR o.f.j.StoreManager$FetchConfigurationImpl -
setReadLockLevel()
14:56:46.037 [main] ERROR o.f.j.StoreManager$FetchConfigurationImpl -
setWriteLockLevel()
14:56:46.037 [main] ERROR o.f.j.StoreManager$FetchConfigurationImpl -
lockTimeout()
14:56:46.038 [main] ERROR o.f.jpa.StoreManager - beforeStateChange()
14:56:46.046 [main] ERROR o.f.jpa.StoreManager - beforeStateChange()
14:56:46.046 [main] ERROR o.f.jpa.StoreManager - close()
14:56:46.047 [main] ERROR o.f.jpa.BrokerFactory - #########
newStoreManager() !!!
14:56:46.047 [main] ERROR o.f.jpa.StoreManager - setContext()
14:56:46.047 [main] ERROR o.f.jpa.StoreManager - newFetchConfiguration()
14:56:46.047 [main] ERROR o.f.j.StoreManager$FetchConfigurationImpl -
setContext()
14:56:46.047 [main] ERROR o.f.jpa.StoreManager -
newQuery(javax.persistence.JPQL)
14:56:46.135 [main] ERROR o.f.j.StoreManager$FetchConfigurationImpl -
getFetchBatchSize()
14:56:46.135 [main] ERROR o.f.j.StoreManager$FetchConfigurationImpl -
getFetchBatchSize()
14:56:46.135 [main] ERROR o.f.j.StoreManager$FetchConfigurationImpl -
getFetchBatchSize()
14:56:46.138 [main] ERROR o.f.jpa.StoreManager - executeExtent()
14:56:46.139 [main] ERROR o.f.jpa.ResultObjectProviderImpl - open()
14:56:46.139 [main] ERROR o.f.jpa.ResultObjectProviderImpl - next()
14:56:46.139 [main] ERROR o.f.jpa.ResultObjectProviderImpl - close()
14:56:46.145 [main] ERROR o.f.j.StoreManager$FetchConfigurationImpl -
newResultList()
/

I think I understand how the entities are loaded and JDBCStoreManager seems
to have everything for it (like executeIntent() and createStoreQuery()).
But I don't understand where the code leading to say an "INSERT INTO..." is
called based on the flow logged here.
I checked begin() and flush() and commit() in (many) classes of OpenJPA but
I see nothing that would ultimately lead to an "INSERT INTO..." at some
point. And the JDBCStoreManager looks more like a SELECT/LOAD manager than
anything else...I'm clueless :-P

Could someone please help me understand...how it works?
I looks like OpenJPA has a very good architecture and I should be able to
create my own data store...am I wrong?


Thank you for you help!
Luc.



--
View this message in context: http://openjpa.208410.n2.nabble.com/Custom-data-store-implementation-guidelines-tp7583851.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message