Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » Mapping class from another plug-in
Mapping class from another plug-in [message #1016193] Tue, 05 March 2013 07:47 Go to previous message
Luiz E. is currently offline Luiz E.
Messages: 97
Registered: September 2010
Member
Hi all
I have a plug-in, which is the core of our app. The plug-in is br.com.germantech.ecf

Now, I made a plug-in, and this plug-in will contribute to our core plug-in. This works fine, he added new menus and everything.
But turns out that this new plug-in will create new tables too...
So, I created a manifest like this

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Germantech - Industria
Bundle-SymbolicName: br.com.germantech.industria;singleton:=true
Bundle-Version: 0.0.1
Bundle-Activator: br.com.germantech.industria.ActivatorIndustria
Bundle-Vendor: German Tech Sistemas
JPA-PersistenceUnits: gtech-industria
Meta-Persistence: META-INF/persistence.xml 
Require-Bundle: org.eclipse.ui,
 org.eclipse.core.runtime,
 javax.persistence;bundle-version="2.0.4",
 org.eclipse.persistence.antlr;bundle-version="3.2.0",
 org.eclipse.persistence.asm;bundle-version="3.3.1",
 org.eclipse.persistence.core;bundle-version="2.4.1",
 org.eclipse.persistence.jpa;bundle-version="2.4.1",
 org.eclipse.persistence.jpa.jpql;bundle-version="2.0.1"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: br.com.germantech.ecf.api,
 br.com.germantech.ecf.aplicacao.helpers,
 br.com.germantech.ecf.dominio.modelo.produto,
 org.postgresql
Bundle-ActivationPolicy: lazy


and created a class like this

package br.com.germantech.industria.dominio.modelo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import br.com.germantech.ecf.dominio.modelo.produto.Produto;

@Entity
public class Producao implements Serializable {
	private static final long serialVersionUID = -4643897338650864928L;
	
	@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id;
	
	@Temporal(TemporalType.DATE)
	private Date dataProducao;
	
	@OneToMany
	private List<Produto> produtosFinalizados = new ArrayList<Produto>();

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Date getDataProducao() {
		return dataProducao;
	}

	public void setDataProducao(Date dataProducao) {
		this.dataProducao = dataProducao;
	}
	
	public List<Produto> getProdutosFinalizados() {
		return produtosFinalizados;
	}
	
	public void setProdutosFinalizados(List<Produto> produtosFinalizados) {
		this.produtosFinalizados = produtosFinalizados;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Producao other = (Producao) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
}


The class Producao is a class from our new plug-in, and the class Produto is a class from our core plug-in...
When I start the plug-ins, I see this:

Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [gtech-industria] failed.
Internal Exception: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.ValidationException
Exception Description: [class br.com.germantech.industria.dominio.modelo.Producao] uses a non-entity [class br.com.germantech.ecf.dominio.modelo.produto.Produto] as target entity in the relationship attribute [field produtosFinalizados].
	at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:127)
	at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:118)
	at br.com.germantech.industria.infraestrutura.persistencia.GermantechEntityManagerIndustria.init(GermantechEntityManagerIndustria.java:50)
	at br.com.germantech.industria.infraestrutura.persistencia.GermantechEntityManagerIndustria.getEntityManager(GermantechEntityManagerIndustria.java:59)
	at br.com.germantech.industria.ActivatorIndustria.start(ActivatorIndustria.java:31)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
	... 12 more


My question is: how to map a class from one plug-in into another plug-in?
I tried to put Produto into the new plugin's persistence.xml, and that didn't worked too

thanks in advance
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Gemini JPA: single persistence bundle too restrictive
Next Topic:ClassCastException when using reference-list ServiceReference
Goto Forum:
  


Current Time: Mon May 20 12:20:40 EDT 2013

Powered by FUDForum. Page generated in 0.01622 seconds