Yes, if you create two different factories.
If you stick to JPA, you can use the same entity classes in both persistence unit configurations but you won't be able to use a single factory to work on both the datastores at the same time.
This is a simple example taken from one of the tests we have in the repository that creates an entity manager for Hibernate ORM and one for Hibernate OGM:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="ogm" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>
</persistence-unit>
<persistence-unit name="no-ogm" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
</properties>
</persistence-unit>
</persistence>
You need to set the right properties for your use case.
You can get the right factory using:
EntityManagerFactory emf = Persistence.createEntityManagerFactory( "ogm" );
You can do something similar with annotations as well.