i am migrating application mysql database to mongodb using hibernate-ogm. In my pojo class i used InheritanceType.JOINED. its giving following error. in hibernate its working fine for me. In hibernate-ogm its givving error. hibernate-OGM official document i read "Hibernate OGM supports the following inheritance strategies: * InheritanceType.TABLE_PER_CLASS * InheritanceType.SINGLE_TABLE " only.
Code:
Caused by: java.lang.UnsupportedOperationException: Joined subclasses strategy not supported
at org.hibernate.ogm.jpa.impl.OgmPersisterClassResolver.joinedSubclassEntityPersister(OgmPersisterClassResolver.java:32)
same question i posted in stackoverflow
http://stackoverflow.com/questions/40779297/is-hibernate-ogm-does-not-supports-inheritancetype-joinedMy pojo class is
Code:
/**
* For add new Resource.
*
* @author Suman Behara
* @version 1
* @since 1
*
*/
@Entity
@Table(name = "resource")
@Inheritance(strategy = InheritanceType.JOINED)
@AttributeOverride(name = "id", column= @Column(name = "resourceId"))
public class Resource extends BaseEntity implements Serializable {
@Column(name = "resourceName", nullable = false, unique = true)
private String resourceName;
private String organization;
private String contactPersonName;
private String designation;
private String address;
private String email;
public String getResourceName() {
return resourceName;
}
public void setResourceName(String resourceName) {
this.resourceName = resourceName;
}
public String getOrganization() {
return organization;
}
public void setOrganization(String organization) {
this.organization = organization;
}
public String getContactPersonName() {
return contactPersonName;
}
public void setContactPersonName(String contactPersonName) {
this.contactPersonName = contactPersonName;
}
public String getDesignation() {
return designation;
}
public void setDesignation(String designation) {
this.designation = designation;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
Code:
/**
* For add new Meta-data Resource.
*
* @author Suman Behara
* @version 1
* @since 1
*
*/
@Entity
@Table(name ="metadata")
@PrimaryKeyJoinColumn(name = "resourceId")
public class Metadata extends Resource implements Serializable {
@Column(name = "contentWithMetadata", columnDefinition = "bit(1)")
private boolean contentWithMetadata;
@Column(name = "childResourceName", nullable = false, unique = true)
private String childResourceName;
private String parentResourceName;
@Column(name = "childResourceId", nullable = false, unique = true)
private String childResourceId;
private String parentResourceId;
public String getChildResourceName() {
return childResourceName;
}
public void setChildResourceName(String childResourceName) {
this.childResourceName = childResourceName;
}
public String getParentResourceName() {
return parentResourceName;
}
public void setParentResourceName(String parentResourceName) {
this.parentResourceName = parentResourceName;
}
public String getChildResourceId() {
return childResourceId;
}
public void setChildResourceId(String childResourceId) {
this.childResourceId = childResourceId;
}
public String getParentResourceId() {
return parentResourceId;
}
public void setParentResourceId(String parentResourceId) {
this.parentResourceId = parentResourceId;
}
public boolean isContentWithMetadata() {
return contentWithMetadata;
}
public void setContentWithMetadata(boolean contentWithMetadata) {
this.contentWithMetadata = contentWithMetadata;
}
}