Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Teneo/EclipseLink]Entity class [class model.impl.BookImpl] has no primary key specified
[Teneo/EclipseLink]Entity class [class model.impl.BookImpl] has no primary key specified [message #532926] Tue, 11 May 2010 15:04 Go to next message
Eclipse UserFriend
Originally posted by: philippe.roland.atosorigin.com

Hey,

EclipseLink newbie here. After getting the provided library sample to
run, I set out to make my own smaller example to get to grips with how
the whole thing worked.
I'm sorry if I'm a little verbose about it, but I want to be 100% sure I
didn't screw up somewhere along the way.

I created an Ecore model with an Author class (with a name EString
tagged as ID) and a Book class (ID is a title EString) with a one-to-one
reference to Author; I then used this .ecore file to create a genmodel
and generated all.
Then, I generated the orm.xml file using the menu and set up my
persistence.xml to use derby's embedded driver.


I'm running into two issues here:

1)Generating the orm file invariably raises a popup stating that:
An internal error occurred during: "Generate Mapping File".
java.lang.NullPointerException

This popup leads to the error log, where I find the following:
eclipse.buildId=M20100211-1343
java.version=1.6.0_02
java.vendor=Sun Microsystems Inc.
....
java.lang.NullPointerException
at org.eclipse.core.runtime.CoreException.<init>(CoreException.java:44)
at
org.eclipse.emf.teneo.eclipse.genxml.RunGenerateJob.runInWor kspace(RunGenerateJob.java:111)
at
org.eclipse.core.internal.resources.InternalWorkspaceJob.run (InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Despite this, an orm file is generated which (to my untrained eyes)
doesn't seem suspicious or malformed.


2)Attempting to run my test class with it leads to the following
exception, however:

Exception in thread "main" Local Exception Stack:
Exception [EclipseLink-30005] (Eclipse Persistence Services -
2.0.2.v20100323-r6872):
org.eclipse.persistence.exceptions.PersistenceUnitLoadingExc eption
Exception Description: An exception was thrown while searching for
persistence archives with ClassLoader:
sun.misc.Launcher$AppClassLoader@fabe9
....
Internal Exception: Exception [EclipseLink-7161] (Eclipse Persistence
Services - 2.0.2.v20100323-r6872):
org.eclipse.persistence.exceptions.ValidationException
Exception Description: Entity class [class model.impl.BookImpl] has no
primary key specified. It should define either an @Id, @EmbeddedId or an
@IdClass. If you have defined PK using any of these annotations then
make sure that you do not have mixed access-type (both fields and
properties annotated) in your entity class hierarchy.
at
org.eclipse.persistence.exceptions.PersistenceUnitLoadingExc eption.exceptionSearchingForPersistenceResources(Persistence UnitLoadingException.java:126)
at
org.eclipse.persistence.jpa.PersistenceProvider.createEntity ManagerFactory(PersistenceProvider.java:133)
at
org.eclipse.persistence.jpa.PersistenceProvider.createEntity ManagerFactory(PersistenceProvider.java:65)
at persist.Test.<init>(Test.java:23)
at persist.Test.main(Test.java:30)
....


Any ideas? Test class, project manifest file, persistence.xml and
produced orm file follow.

Regards,
Philippe Roland

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%
package persist;
import java.util.HashMap;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;

import model.Author;
import model.Book;
import model.ModelPackage;

import org.eclipse.persistence.config.PersistenceUnitProperties;
import org.eclipse.persistence.jpa.PersistenceProvider;

public class Test {

EntityManagerFactory factory;
EntityManager em;

public Test(){
HashMap<String, Object> properties = new HashMap<String, Object>();
properties.put(PersistenceUnitProperties.CLASSLOADER,
this.getClass().getClassLoader());
PersistenceProvider persProv = new PersistenceProvider();
factory = persProv.createEntityManagerFactory("samplePU",properties);

em = factory.createEntityManager();
}


public static void main(String[] args){
Test test = new Test();
//test.write();
//test.read();
}
....
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: SampleModel;singleton:=true
Bundle-Version: 1.0.0
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: model,
model.impl,
model.util
Require-Bundle: org.eclipse.emf.teneo.orm;bundle-version="1.0.0",
org.apache.commons.logging;bundle-version="1.0.4",
org.eclipse.emf.teneo.annotations.source;bundle-version="1.1.2 ",
org.eclipse.emf.teneo.eclipse;bundle-version="1.1.2",
javax.persistence;bundle-version="2.0.0",
org.eclipse.emf.teneo.eclipselink;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%

<?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" version="1.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="samplePU">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider >

<class>model.impl.BookImpl</class>
<class>model.impl.AuthorImpl</class>

<properties>
<property name="eclipselink.target-database" value="Derby"/>
<property name="eclipselink.jdbc.driver"
value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="eclipselink.jdbc.url"
value="jdbc:derby:memory:myDB;create=true"/>
<property name="eclipselink.jdbc.user" value="admin"/>
<property name="eclipselink.jdbc.password" value="admin"/>

<property name="eclipselink.session.customizer"
value="org.eclipse.emf.teneo.eclipselink.EmfSessionCustomizer "/>

<property name="eclipselink.jdbc.read-connections.min" value="1"/>
<property name="eclipselink.jdbc.write-connections.min" value="1"/>
<property name="eclipselink.ddl-generation"
value="drop-and-create-tables"/>
<property name="eclipselink.ddl-generation.output-mode"
value="database"/>
</properties>
</persistence-unit>
</persistence>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%

<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" version="1.0">
<persistence-unit-metadata>
<xml-mapping-metadata-complete/>
<persistence-unit-defaults>
<access>FIELD</access>
</persistence-unit-defaults>
</persistence-unit-metadata>
<entity class="model.impl.BookImpl" name="Book">
<table name="BOOK"/>
<inheritance strategy="JOINED"/>
<attributes>
<basic fetch="EAGER" name="title" optional="false"/>
<basic name="eContainerFeatureID">
<column name="ECONT_FEAT_ID"/>
</basic>
<many-to-one fetch="EAGER" name="author" optional="false"
target-entity="model.impl.AuthorImpl">
<join-column insertable="true" name="AUTHOR_AUTHOR_E_ID"
nullable="false" unique="false" updatable="true"/>
<cascade>
<cascade-persist/>
<cascade-merge/>
<cascade-refresh/>
</cascade>
</many-to-one>
</attributes>
</entity>
<entity class="model.impl.AuthorImpl" name="Author">
<table name="AUTHOR"/>
<inheritance strategy="JOINED"/>
<attributes>
<basic fetch="EAGER" name="name" optional="false"/>
<basic name="eContainerFeatureID">
<column name="ECONT_FEAT_ID"/>
</basic>
</attributes>
</entity>
</entity-mappings>
Re: [Teneo/EclipseLink]Entity class [class model.impl.BookImpl] has no primary key specified [message #532930 is a reply to message #532926] Tue, 11 May 2010 15:15 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Philippe,
Can you enter a bugzilla on Teneo for the NPE, with the full stacktrace?

For the other issue (no id member) you can solve this by defining one of the efeatures of the eclass as the id. You do
this by setting an eannotation on the efeature. The efeature should have the source: 'teneo.jpa' a key called 'value'
and a value: @Id.

See here for the annotation format:
http://wiki.eclipse.org/Teneo/Hibernate/ModelRelational/Anno tations_Format

gr. Martin

Philippe Roland wrote:
> Hey,
>
> EclipseLink newbie here. After getting the provided library sample to
> run, I set out to make my own smaller example to get to grips with how
> the whole thing worked.
> I'm sorry if I'm a little verbose about it, but I want to be 100% sure I
> didn't screw up somewhere along the way.
>
> I created an Ecore model with an Author class (with a name EString
> tagged as ID) and a Book class (ID is a title EString) with a one-to-one
> reference to Author; I then used this .ecore file to create a genmodel
> and generated all.
> Then, I generated the orm.xml file using the menu and set up my
> persistence.xml to use derby's embedded driver.
>
>
> I'm running into two issues here:
>
> 1)Generating the orm file invariably raises a popup stating that:
> An internal error occurred during: "Generate Mapping File".
> java.lang.NullPointerException
>
> This popup leads to the error log, where I find the following:
> eclipse.buildId=M20100211-1343
> java.version=1.6.0_02
> java.vendor=Sun Microsystems Inc.
> ....
> java.lang.NullPointerException
> at org.eclipse.core.runtime.CoreException.<init>(CoreException.java:44)
> at
> org.eclipse.emf.teneo.eclipse.genxml.RunGenerateJob.runInWor kspace(RunGenerateJob.java:111)
>
> at
> org.eclipse.core.internal.resources.InternalWorkspaceJob.run (InternalWorkspaceJob.java:38)
>
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
>
> Despite this, an orm file is generated which (to my untrained eyes)
> doesn't seem suspicious or malformed.
>
>
> 2)Attempting to run my test class with it leads to the following
> exception, however:
>
> Exception in thread "main" Local Exception Stack:
> Exception [EclipseLink-30005] (Eclipse Persistence Services -
> 2.0.2.v20100323-r6872):
> org.eclipse.persistence.exceptions.PersistenceUnitLoadingExc eption
> Exception Description: An exception was thrown while searching for
> persistence archives with ClassLoader:
> sun.misc.Launcher$AppClassLoader@fabe9
> ....
> Internal Exception: Exception [EclipseLink-7161] (Eclipse Persistence
> Services - 2.0.2.v20100323-r6872):
> org.eclipse.persistence.exceptions.ValidationException
> Exception Description: Entity class [class model.impl.BookImpl] has no
> primary key specified. It should define either an @Id, @EmbeddedId or an
> @IdClass. If you have defined PK using any of these annotations then
> make sure that you do not have mixed access-type (both fields and
> properties annotated) in your entity class hierarchy.
> at
> org.eclipse.persistence.exceptions.PersistenceUnitLoadingExc eption.exceptionSearchingForPersistenceResources(Persistence UnitLoadingException.java:126)
>
> at
> org.eclipse.persistence.jpa.PersistenceProvider.createEntity ManagerFactory(PersistenceProvider.java:133)
>
> at
> org.eclipse.persistence.jpa.PersistenceProvider.createEntity ManagerFactory(PersistenceProvider.java:65)
>
> at persist.Test.<init>(Test.java:23)
> at persist.Test.main(Test.java:30)
> ....
>
>
> Any ideas? Test class, project manifest file, persistence.xml and
> produced orm file follow.
>
> Regards,
> Philippe Roland
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%
> package persist;
> import java.util.HashMap;
> import javax.persistence.EntityManager;
> import javax.persistence.EntityManagerFactory;
>
> import model.Author;
> import model.Book;
> import model.ModelPackage;
>
> import org.eclipse.persistence.config.PersistenceUnitProperties;
> import org.eclipse.persistence.jpa.PersistenceProvider;
>
> public class Test {
>
> EntityManagerFactory factory;
> EntityManager em;
>
> public Test(){
> HashMap<String, Object> properties = new HashMap<String, Object>();
> properties.put(PersistenceUnitProperties.CLASSLOADER,
> this.getClass().getClassLoader());
> PersistenceProvider persProv = new PersistenceProvider();
> factory =
> persProv.createEntityManagerFactory("samplePU",properties);
>
> em = factory.createEntityManager();
> }
>
>
> public static void main(String[] args){
> Test test = new Test();
> //test.write();
> //test.read();
> }
> ....
> }
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%
>
> Manifest-Version: 1.0
> Bundle-ManifestVersion: 2
> Bundle-Name: %pluginName
> Bundle-SymbolicName: SampleModel;singleton:=true
> Bundle-Version: 1.0.0
> Bundle-ClassPath: .
> Bundle-Vendor: %providerName
> Bundle-Localization: plugin
> Bundle-RequiredExecutionEnvironment: JavaSE-1.6
> Export-Package: model,
> model.impl,
> model.util
> Require-Bundle: org.eclipse.emf.teneo.orm;bundle-version="1.0.0",
> org.apache.commons.logging;bundle-version="1.0.4",
> org.eclipse.emf.teneo.annotations.source;bundle-version="1.1.2 ",
> org.eclipse.emf.teneo.eclipse;bundle-version="1.1.2",
> javax.persistence;bundle-version="2.0.0",
> org.eclipse.emf.teneo.eclipselink;bundle-version="1.0.0"
> Bundle-ActivationPolicy: lazy
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%
>
> <?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" version="1.0"
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
> <persistence-unit name="samplePU">
>
> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider >
>
> <class>model.impl.BookImpl</class>
> <class>model.impl.AuthorImpl</class>
>
> <properties>
> <property name="eclipselink.target-database" value="Derby"/>
> <property name="eclipselink.jdbc.driver"
> value="org.apache.derby.jdbc.EmbeddedDriver"/>
> <property name="eclipselink.jdbc.url"
> value="jdbc:derby:memory:myDB;create=true"/>
> <property name="eclipselink.jdbc.user" value="admin"/>
> <property name="eclipselink.jdbc.password" value="admin"/>
>
> <property name="eclipselink.session.customizer"
> value="org.eclipse.emf.teneo.eclipselink.EmfSessionCustomizer "/>
>
> <property name="eclipselink.jdbc.read-connections.min"
> value="1"/>
> <property name="eclipselink.jdbc.write-connections.min"
> value="1"/>
> <property name="eclipselink.ddl-generation"
> value="drop-and-create-tables"/>
> <property name="eclipselink.ddl-generation.output-mode"
> value="database"/>
> </properties>
> </persistence-unit>
> </persistence>
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%
>
> <?xml version="1.0" encoding="UTF-8"?>
> <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
> http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" version="1.0">
> <persistence-unit-metadata>
> <xml-mapping-metadata-complete/>
> <persistence-unit-defaults>
> <access>FIELD</access>
> </persistence-unit-defaults>
> </persistence-unit-metadata>
> <entity class="model.impl.BookImpl" name="Book">
> <table name="BOOK"/>
> <inheritance strategy="JOINED"/>
> <attributes>
> <basic fetch="EAGER" name="title" optional="false"/>
> <basic name="eContainerFeatureID">
> <column name="ECONT_FEAT_ID"/>
> </basic>
> <many-to-one fetch="EAGER" name="author" optional="false"
> target-entity="model.impl.AuthorImpl">
> <join-column insertable="true" name="AUTHOR_AUTHOR_E_ID"
> nullable="false" unique="false" updatable="true"/>
> <cascade>
> <cascade-persist/>
> <cascade-merge/>
> <cascade-refresh/>
> </cascade>
> </many-to-one>
> </attributes>
> </entity>
> <entity class="model.impl.AuthorImpl" name="Author">
> <table name="AUTHOR"/>
> <inheritance strategy="JOINED"/>
> <attributes>
> <basic fetch="EAGER" name="name" optional="false"/>
> <basic name="eContainerFeatureID">
> <column name="ECONT_FEAT_ID"/>
> </basic>
> </attributes>
> </entity>
> </entity-mappings>
>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Teneo/EclipseLink]Entity class [class model.impl.BookImpl] has no primary key specified [message #533141 is a reply to message #532930] Wed, 12 May 2010 11:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: philippe.roland.atosorigin.com

That did it! Thanks for the help.
Bug filed over at https://bugs.eclipse.org/bugs/show_bug.cgi?id=312587

Regards,
Philippe

Martin Taal a écrit :
> Hi Philippe,
> Can you enter a bugzilla on Teneo for the NPE, with the full stacktrace?
>
> For the other issue (no id member) you can solve this by defining one of
> the efeatures of the eclass as the id. You do this by setting an
> eannotation on the efeature. The efeature should have the source:
> 'teneo.jpa' a key called 'value' and a value: @Id.
>
> See here for the annotation format:
> http://wiki.eclipse.org/Teneo/Hibernate/ModelRelational/Anno tations_Format
>
> gr. Martin
>
> Philippe Roland wrote:
>> Hey,
>>
>> EclipseLink newbie here. After getting the provided library sample to
>> run, I set out to make my own smaller example to get to grips with how
>> the whole thing worked.
>> I'm sorry if I'm a little verbose about it, but I want to be 100% sure I
>> didn't screw up somewhere along the way.
>>
>> I created an Ecore model with an Author class (with a name EString
>> tagged as ID) and a Book class (ID is a title EString) with a one-to-one
>> reference to Author; I then used this .ecore file to create a genmodel
>> and generated all.
>> Then, I generated the orm.xml file using the menu and set up my
>> persistence.xml to use derby's embedded driver.
>>
>>
>> I'm running into two issues here:
>>
>> 1)Generating the orm file invariably raises a popup stating that:
>> An internal error occurred during: "Generate Mapping File".
>> java.lang.NullPointerException
>>
>> This popup leads to the error log, where I find the following:
>> eclipse.buildId=M20100211-1343
>> java.version=1.6.0_02
>> java.vendor=Sun Microsystems Inc.
>> ....
>> java.lang.NullPointerException
>> at org.eclipse.core.runtime.CoreException.<init>(CoreException.java:44)
>> at
>> org.eclipse.emf.teneo.eclipse.genxml.RunGenerateJob.runInWor kspace(RunGenerateJob.java:111)
>>
>> at
>> org.eclipse.core.internal.resources.InternalWorkspaceJob.run (InternalWorkspaceJob.java:38)
>>
>> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
>>
>> Despite this, an orm file is generated which (to my untrained eyes)
>> doesn't seem suspicious or malformed.
>>
>>
>> 2)Attempting to run my test class with it leads to the following
>> exception, however:
>>
>> Exception in thread "main" Local Exception Stack:
>> Exception [EclipseLink-30005] (Eclipse Persistence Services -
>> 2.0.2.v20100323-r6872):
>> org.eclipse.persistence.exceptions.PersistenceUnitLoadingExc eption
>> Exception Description: An exception was thrown while searching for
>> persistence archives with ClassLoader:
>> sun.misc.Launcher$AppClassLoader@fabe9
>> ....
>> Internal Exception: Exception [EclipseLink-7161] (Eclipse Persistence
>> Services - 2.0.2.v20100323-r6872):
>> org.eclipse.persistence.exceptions.ValidationException
>> Exception Description: Entity class [class model.impl.BookImpl] has no
>> primary key specified. It should define either an @Id, @EmbeddedId or an
>> @IdClass. If you have defined PK using any of these annotations then
>> make sure that you do not have mixed access-type (both fields and
>> properties annotated) in your entity class hierarchy.
>> at
>> org.eclipse.persistence.exceptions.PersistenceUnitLoadingExc eption.exceptionSearchingForPersistenceResources(Persistence UnitLoadingException.java:126)
>>
>> at
>> org.eclipse.persistence.jpa.PersistenceProvider.createEntity ManagerFactory(PersistenceProvider.java:133)
>>
>> at
>> org.eclipse.persistence.jpa.PersistenceProvider.createEntity ManagerFactory(PersistenceProvider.java:65)
>>
>> at persist.Test.<init>(Test.java:23)
>> at persist.Test.main(Test.java:30)
>> ....
>>
>>
>> Any ideas? Test class, project manifest file, persistence.xml and
>> produced orm file follow.
>>
>> Regards,
>> Philippe Roland
>>
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%
>> package persist;
>> import java.util.HashMap;
>> import javax.persistence.EntityManager;
>> import javax.persistence.EntityManagerFactory;
>>
>> import model.Author;
>> import model.Book;
>> import model.ModelPackage;
>>
>> import org.eclipse.persistence.config.PersistenceUnitProperties;
>> import org.eclipse.persistence.jpa.PersistenceProvider;
>> public class Test {
>>
>> EntityManagerFactory factory;
>> EntityManager em;
>>
>> public Test(){
>> HashMap<String, Object> properties = new HashMap<String,
>> Object>();
>> properties.put(PersistenceUnitProperties.CLASSLOADER,
>> this.getClass().getClassLoader());
>> PersistenceProvider persProv = new PersistenceProvider();
>> factory =
>> persProv.createEntityManagerFactory("samplePU",properties);
>> em = factory.createEntityManager();
>> }
>> public static void main(String[] args){
>> Test test = new Test();
>> //test.write();
>> //test.read();
>> }
>> ....
>> }
>>
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%
>>
>> Manifest-Version: 1.0
>> Bundle-ManifestVersion: 2
>> Bundle-Name: %pluginName
>> Bundle-SymbolicName: SampleModel;singleton:=true
>> Bundle-Version: 1.0.0
>> Bundle-ClassPath: .
>> Bundle-Vendor: %providerName
>> Bundle-Localization: plugin
>> Bundle-RequiredExecutionEnvironment: JavaSE-1.6
>> Export-Package: model,
>> model.impl,
>> model.util
>> Require-Bundle: org.eclipse.emf.teneo.orm;bundle-version="1.0.0",
>> org.apache.commons.logging;bundle-version="1.0.4",
>> org.eclipse.emf.teneo.annotations.source;bundle-version="1.1.2 ",
>> org.eclipse.emf.teneo.eclipse;bundle-version="1.1.2",
>> javax.persistence;bundle-version="2.0.0",
>> org.eclipse.emf.teneo.eclipselink;bundle-version="1.0.0"
>> Bundle-ActivationPolicy: lazy
>>
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%
>>
>> <?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" version="1.0"
>> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
>> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
>> <persistence-unit name="samplePU">
>>
>> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider >
>> <class>model.impl.BookImpl</class>
>> <class>model.impl.AuthorImpl</class>
>>
>> <properties> <property
>> name="eclipselink.target-database" value="Derby"/>
>> <property name="eclipselink.jdbc.driver"
>> value="org.apache.derby.jdbc.EmbeddedDriver"/>
>> <property name="eclipselink.jdbc.url"
>> value="jdbc:derby:memory:myDB;create=true"/>
>> <property name="eclipselink.jdbc.user" value="admin"/>
>> <property name="eclipselink.jdbc.password" value="admin"/>
>>
>> <property name="eclipselink.session.customizer"
>> value="org.eclipse.emf.teneo.eclipselink.EmfSessionCustomizer "/>
>> <property
>> name="eclipselink.jdbc.read-connections.min" value="1"/>
>> <property name="eclipselink.jdbc.write-connections.min"
>> value="1"/>
>> <property name="eclipselink.ddl-generation"
>> value="drop-and-create-tables"/>
>> <property name="eclipselink.ddl-generation.output-mode"
>> value="database"/>
>> </properties>
>> </persistence-unit>
>> </persistence>
>>
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
>> http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" version="1.0">
>> <persistence-unit-metadata>
>> <xml-mapping-metadata-complete/>
>> <persistence-unit-defaults>
>> <access>FIELD</access>
>> </persistence-unit-defaults>
>> </persistence-unit-metadata>
>> <entity class="model.impl.BookImpl" name="Book">
>> <table name="BOOK"/>
>> <inheritance strategy="JOINED"/>
>> <attributes>
>> <basic fetch="EAGER" name="title" optional="false"/>
>> <basic name="eContainerFeatureID">
>> <column name="ECONT_FEAT_ID"/>
>> </basic>
>> <many-to-one fetch="EAGER" name="author" optional="false"
>> target-entity="model.impl.AuthorImpl">
>> <join-column insertable="true" name="AUTHOR_AUTHOR_E_ID"
>> nullable="false" unique="false" updatable="true"/>
>> <cascade>
>> <cascade-persist/>
>> <cascade-merge/>
>> <cascade-refresh/>
>> </cascade>
>> </many-to-one>
>> </attributes>
>> </entity>
>> <entity class="model.impl.AuthorImpl" name="Author">
>> <table name="AUTHOR"/>
>> <inheritance strategy="JOINED"/>
>> <attributes>
>> <basic fetch="EAGER" name="name" optional="false"/>
>> <basic name="eContainerFeatureID">
>> <column name="ECONT_FEAT_ID"/>
>> </basic>
>> </attributes>
>> </entity>
>> </entity-mappings>
>>
>>
>>
>
>
Re: [Teneo/EclipseLink]Entity class [class model.impl.BookImpl] has no primary key specified [message #657863 is a reply to message #532926] Fri, 04 March 2011 12:05 Go to previous messageGo to next message
Jens Mising name is currently offline Jens Mising nameFriend
Messages: 12
Registered: March 2010
Location: Berlin
Junior Member
I just ran into the same problem with the NPE and so I thought I bump this thread again.

java.lang.NullPointerException
at org.eclipse.core.runtime.CoreException.<init>(CoreException.java:43)
at org.eclipse.emf.teneo.eclipse.genxml.RunGenerateJob.runInWorkspace(RunGenerateJob.java:111)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)


Looking at the code I see:
		if (true) {
			throw new CoreException(null);
		}

in
org.eclipse.emf.teneo.eclipse.genxml.RunGenerateJob.runInWorkspace(IProgressMonitor)


I surely do not understand the code at all but this seems to be strange.
The filed bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=312587 is still in status NEW though.

I just wanted to report this. I know (I guess) developers spend a lot of time to maintain and develop all this software and it's all for free. So don't missunderstand my bump - I'm not complaining. Smile

Jens
Re: [Teneo/EclipseLink]Entity class [class model.impl.BookImpl] has no primary key specified [message #658170 is a reply to message #657863] Mon, 07 March 2011 09:26 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Jens,
Which Teneo version are you using? This throw statement has been removed and is not present anymore.
You can find the latest Teneo version here:
http://download.eclipse.org/modeling/emf/teneo/updates/1.2.0 /interim/

Btw, the Teneo EclipseLink integration is not being used a lot. Another interesting project which is being tested
extensively with EclipseLink is the Texo project. It is aimed at server side code generation (so not for rcp's) and
offers better/easier integration with ORM layers such as EclipseLink:
http://wiki.eclipse.org/Texo

gr. Martin

On 03/04/2011 01:05 PM, Jens Helweg wrote:
> I just ran into the same problem with the NPE and so I thought I bump this thread again.
>
> java.lang.NullPointerException
> at org.eclipse.core.runtime.CoreException.<init>(CoreException.java:43)
> at org.eclipse.emf.teneo.eclipse.genxml.RunGenerateJob.runInWor kspace(RunGenerateJob.java:111)
> at org.eclipse.core.internal.resources.InternalWorkspaceJob.run (InternalWorkspaceJob.java:38)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
>
>
> Looking at the code I see:
> if (true) {
> throw new CoreException(null);
> }
>
> in org.eclipse.emf.teneo.eclipse.genxml.RunGenerateJob.runInWor kspace(IProgressMonitor)
>
> I surely do not understand the code at all but this seems to be strange. The filed bug
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=312587 is still in status NEW though.
> I just wanted to report this. I know (I guess) developers spend a lot of time to maintain and develop all this software
> and it's all for free. So don't missunderstand my bump - I'm not complaining. :)
>
> Jens
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:Reusable editor
Next Topic:EcoreUtil.copy() throws Exception when copying recorded ChangeDescription
Goto Forum:
  


Current Time: Wed Oct 23 17:46:04 GMT 2019

Powered by FUDForum. Page generated in 0.02259 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top