-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: OGM entities created in the ORM datastore
PostPosted: Thu Mar 31, 2016 4:12 pm 
Newbie

Joined: Thu Nov 13, 2014 8:49 am
Posts: 9
Hi,

I have a project which has two datastores. One is a Hibernate ORM datastore to a postgress database and the other to a OGM datastore to a NoSQL MongoDB datastore. Can someone tell me how to stop OGM entities being created in the ORM datastore?


Top
 Profile  
 
 Post subject: Re: OGM entities created in the ORM datastore
PostPosted: Mon Apr 04, 2016 4:38 am 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 388
Hi,

can you share details of your configuration (persistence.xml, how do entities look like etc.)? What you describe is not expected, are you sharing the entity types between the two persistence units by any chance? What environment is is this, plain Java SE or WildFly/EAP?

--Gunnar

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


Top
 Profile  
 
 Post subject: Re: OGM entities created in the ORM datastore
PostPosted: Wed May 18, 2016 2:25 am 
Newbie

Joined: Thu Nov 13, 2014 8:49 am
Posts: 9
Hi

My persistence.xml is as shown below. When the project is deployed in the Wildfly version 8.2.0 the entities defined in the OGM datasource (puttputtmongoDS-JTA) are created in the ORM datasource (puttputtDS). I am not sharing entities between the datasources. I have also attached a sample entities in my project.

Appreciate any help to resolve this.

=====================Persistence.xml===================================

<?xml version="1.0" encoding="utf-8"?>
<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/ ... ce_1_0.xsd"
version="1.0">





<persistence-unit name="puttputtDS">

<jta-data-source>java:jboss/datasources/PuttputtDS</jta-data-source>
<class>dbteam.com.jsf.starter.model.Member</class>
<class>dbteam.com.jsf.starter.model.Country</class>
<properties>
<!-- Properties for Hibernate -->
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<!-- <property name="hibernate.hbm2ddl.auto" value="create" /> -->
<!--<property name="hibernate.hbm2ddl.auto" value="update" /> -->
<!-- <property name="hibernate.hbm2ddl.auto" value="validate" /> -->
<!-- <property name="hibernate.show_sql" value="true" /> -->
</properties>
</persistence-unit>



<persistence-unit name="puttputtmongoDS-JTA" transaction-type="JTA">
<provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>

<class>dbteam.com.jsf.starter.model.LineItem</class>
<class>dbteam.com.jsf.starter.model.Product</class>
<class>dbteam.com.jsf.starter.model.Quote</class>
<class>dbteam.com.jsf.starter.model.Image</class>
<class>dbteam.com.jsf.starter.model.Merchant</class>
<class>dbteam.com.jsf.starter.model.Promotions</class>


<properties>
<property name="hibernate.ogm.datastore.provider" value="mongodb" />
<property name="hibernate.ogm.datastore.database" value="hibernate-ogm-dbteam" />
<!--<property name="hibernate.ogm.datastore.create_database" value="true" /> -->
<property name="hibernate.ogm.datastore.host" value="entaap504u"/>
<property name="hibernate.ogm.datastore.port" value="27018"/>
</properties>
</persistence-unit>



</persistence>

=====================================Entity Class============

package dbteam.com.jsf.starter.model;


import java.math.BigDecimal;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.xml.bind.annotation.XmlRootElement;

@Entity
@XmlRootElement
public class Product {
@Id
private String id;

private String sku;
private String description;
private BigDecimal listPrice;
private Integer quantity;

public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getSku() {
return sku;
}
public void setSku(String sku) {
this.sku = sku;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public BigDecimal getListPrice() {
return listPrice;
}
public void setListPrice(BigDecimal listPrice) {
this.listPrice = listPrice;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}

}


Top
 Profile  
 
 Post subject: Re: OGM entities created in the ORM datastore
PostPosted: Thu May 19, 2016 5:05 am 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 295
Hi,
can you try to add
Code:
<exclude-unlisted-classes>true</exclude-unlisted-classes>
in your persistence xml?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.