Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [TENEO] NPE when trying to load an Ecore model containing EEnums
[TENEO] NPE when trying to load an Ecore model containing EEnums [message #98770] Tue, 09 October 2007 14:02 Go to next message
Eclipse UserFriend
Originally posted by: Hugo.Bruneliere.univ-nantes.fr

This is a multi-part message in MIME format.
--------------050308030205070009090208
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

When trying to load an Ecore model (attached to this post) containing
EENums and EAttributes having these EEnums as types, I get the following
error:

Caused by: java.lang.NullPointerException
at
org.eclipse.emf.teneo.hibernate.mapping.DynamicENumUserType. setParameterValues(DynamicENumUserType.java:171)
at org.hibernate.type.TypeFactory.injectParameters(TypeFactory. java:551)
at org.hibernate.type.CustomType.<init>(CustomType.java:67)
at org.hibernate.type.TypeFactory.heuristicType(TypeFactory.jav a:246)
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 60)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
at org.hibernate.mapping.Property.isValid(Property.java:185)
at org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:410)
at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
at org.hibernate.cfg.Configuration.validate(Configuration.java: 1026)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1211)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:177)
at
org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:88)

I found several bugs into the Eclipse/EMFT/Teneo Bugzilla concerning
EEnum (all are marked as fixed). But no one seems to corresponds exactly
to my case.

Have you got an idea about where do my problem come from?

Best regards,

Hugo

--
--------------------------------------------------------
Hugo Bruneliere - R&D Engineer
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssiniere
44322 Nantes Cedex 3 - France
office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
EMail: Hugo.Bruneliere@univ-nantes.fr
http://www.sciences.univ-nantes.fr/lina/atl/
--------------------------------------------------------

--------------050308030205070009090208
Content-Type: text/xml;
name="Bugzilla.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="Bugzilla.ecore"

<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore">
<ecore:EPackage name="PrimitiveTypes" nsURI="atl.primitive.type" nsPrefix="ptyp">
<eClassifiers xsi:type="ecore:EDataType" name="Integer" instanceClassName="int"/>
<eClassifiers xsi:type="ecore:EDataType" name="String" instanceClassName="java.lang.String"/>
<eClassifiers xsi:type="ecore:EDataType" name="Boolean" instanceClassName="boolean"/>
<eClassifiers xsi:type="ecore:EDataType" name="Double" instanceClassName="double"/>
</ecore:EPackage>
<ecore:EPackage name="Bugzilla" nsURI="Bugzilla" nsPrefix="bugzilla">
<eClassifiers xsi:type="ecore:EEnum" name="ErrorType">
<eLiterals name="et_null" value="1"/>
<eLiterals name="et_NotFound" value="2"/>
<eLiterals name="et_NotPermitted" value="3"/>
<eLiterals name="et_InvalidBugId" value="4"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="SeverityType">
<eLiterals name="st_null" value="1"/>
<eLiterals name="st_blocker" value="2"/>
<eLiterals name="st_critical" value="3"/>
<eLiterals name="st_major" value="4"/>
<eLiterals name="st_normal" value="5"/>
<eLiterals name="st_minor" value="6"/>
<eLiterals name="st_trivial" value="7"/>
<eLiterals name="st_enhancement" value="8"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="StatusType">
<eLiterals name="st_null" value="1"/>
<eLiterals name="st_UNCONFIRMED" value="2"/>
<eLiterals name="st_NEW" value="3"/>
<eLiterals name="st_ASSIGNED" value="4"/>
<eLiterals name="st_REOPENED" value="5"/>
<eLiterals name="st_RESOLVED" value="6"/>
<eLiterals name="st_VERIFIED" value="7"/>
<eLiterals name="st_CLOSED" value="8"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="OperatingSystemType">
<eLiterals name="ost_null" value="1"/>
<eLiterals name="ost_all" value="2"/>
<eLiterals name="ost_Windows 3.1" value="3"/>
<eLiterals name="ost_Windows 95" value="4"/>
<eLiterals name="ost_Windows 98" value="5"/>
<eLiterals name="ost_Windows ME" value="6"/>
<eLiterals name="ost_Windows 2000" value="7"/>
<eLiterals name="ost_Windows NT" value="8"/>
<eLiterals name="ost_Windows XP" value="9"/>
<eLiterals name="ost_Windows Vista" value="10"/>
<eLiterals name="ost_Windows Server 2003" value="11"/>
<eLiterals name="ost_MacSystem 7" value="12"/>
<eLiterals name="ost_MacSystem 7.5" value="13"/>
<eLiterals name="ost_MacSystem 7.6.1" value="14"/>
<eLiterals name="ost_MacSystem 8.0" value="15"/>
<eLiterals name="ost_MacSystem 8.5" value="16"/>
<eLiterals name="ost_MacSystem 8.6" value="17"/>
<eLiterals name="ost_MacSystem 9.x" value="18"/>
<eLiterals name="ost_Mac OS X 10.0" value="19"/>
<eLiterals name="ost_Mac OS X 10.1" value="20"/>
<eLiterals name="ost_Mac OS X 10.2" value="21"/>
<eLiterals name="ost_Mac OS X 10.3" value="22"/>
<eLiterals name="ost_Linux" value="23"/>
<eLiterals name="ost_BDS/OS" value="24"/>
<eLiterals name="ost_FreeBSD" value="25"/>
<eLiterals name="ost_NetBSD" value="26"/>
<eLiterals name="ost_OpenBSD" value="27"/>
<eLiterals name="ost_AIX" value="28"/>
<eLiterals name="ost_BeOS" value="29"/>
<eLiterals name="ost_HP-UX" value="30"/>
<eLiterals name="ost_IRIX" value="31"/>
<eLiterals name="ost_Neutrino" value="32"/>
<eLiterals name="ost_OpenVMS" value="33"/>
<eLiterals name="ost_OS/2" value="34"/>
<eLiterals name="ost_OSF/1" value="35"/>
<eLiterals name="ost_Solaris" value="36"/>
<eLiterals name="ost_SunOS" value="37"/>
<eLiterals name="ost_other" value="38"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="PriorityType">
<eLiterals name="pt_null" value="1"/>
<eLiterals name="pt_P1" value="2"/>
<eLiterals name="pt_P2" value="3"/>
<eLiterals name="pt_P3" value="4"/>
<eLiterals name="pt_P4" value="5"/>
<eLiterals name="pt_P5" value="6"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="ReportedPlatformType">
<eLiterals name="rpt_null" value="1"/>
<eLiterals name="rpt_all" value="2"/>
<eLiterals name="rpt_DEC" value="3"/>
<eLiterals name="rpt_HP" value="4"/>
<eLiterals name="rpt_Macintosh" value="5"/>
<eLiterals name="rpt_PC" value="6"/>
<eLiterals name="rpt_SGI" value="7"/>
<eLiterals name="rpt_Sun" value="8"/>
<eLiterals name="rpt_other" value="9"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="ResolutionType">
<eLiterals name="rt_null" value="1"/>
<eLiterals name="rt_FIXED" value="2"/>
<eLiterals name="rt_INVALID" value="3"/>
<eLiterals name="rt_WONTFIX" value="4"/>
<eLiterals name="rt_LATER" value="5"/>
<eLiterals name="rt_REMIND" value="6"/>
<eLiterals name="rt_DUPLICATE" value="7"/>
<eLiterals name="rt_WORKSFORME" value="8"/>
<eLiterals name="rt_MOVED" value="9"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="BugzillaRoot">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="version" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="urlbase" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="maintainer" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="exporter" ordered="false"
unique="false" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="bugs" lowerBound="1"
upperBound="-1" eType="#/1/Bug" containment="true" eOpposite="#/1/Bug/bug_bugzillaRoot"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Bug">
<eStructuralFeatures xsi:type="ecore:EReference" name="bug_bugzillaRoot" ordered="false"
lowerBound="1" eType="#/1/BugzillaRoot" eOpposite="#/1/BugzillaRoot/bugs"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="error" ordered="false"
unique="false" eType="#/1/ErrorType"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="bug_id" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="exporter" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="urlbase" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="bug_status" ordered="false"
unique="false" lowerBound="1" eType="#/1/StatusType"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="resolution" ordered="false"
unique="false" eType="#/1/ResolutionType"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="product" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="priority" ordered="false"
unique="false" lowerBound="1" eType="#/1/PriorityType"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="version" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="rep_platform" ordered="false"
unique="false" lowerBound="1" eType="#/1/ReportedPlatformType"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="assigned_to" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="delta_ts" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="component" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="reporter" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="target_milestone" ordered="false"
unique="false" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="bug_severity" ordered="false"
unique="false" lowerBound="1" eType="#/1/SeverityType"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="creation_ts" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="qa_contact" ordered="false"
unique="false" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="status_whiteboard" ordered="false"
unique="false" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="op_sys" ordered="false"
unique="false" lowerBound="1" eType="#/1/OperatingSystemType"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="bug_file_loc" ordered="false"
unique="false" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="short_desc" ordered="false"
unique="false" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="keywords" upperBound="-1"
eType="#/1/Keywords" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="dependson" upperBound="-1"
eType="#/1/Dependson" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="blocks" upperBound="-1"
eType="#/1/Blocks" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="cc" upperBound="-1" eType="#/1/Cc"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="long_desc" upperBound="-1"
eType="#/1/LongDesc" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="attachment" upperBound="-1"
eType="#/1/Attachment" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="StringElt" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Keywords" eSuperTypes="#/1/StringElt"/>
<eClassifiers xsi:type="ecore:EClass" name="Dependson" eSuperTypes="#/1/StringElt"/>
<eClassifiers xsi:type="ecore:EClass" name="Blocks" eSuperTypes="#/1/StringElt"/>
<eClassifiers xsi:type="ecore:EClass" name="Cc" eSuperTypes="#/1/StringElt"/>
<eClassifiers xsi:type="ecore:EClass" name="LongDesc">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="isPrivate" ordered="false"
unique="false" lowerBound="1" eType="#/0/Boolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="who" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="bug_when" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="thetext" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Attachment">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="isObsolete" ordered="false"
unique="false" lowerBound="1" eType="#/0/Boolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="isPatch" ordered="false"
unique="false" lowerBound="1" eType="#/0/Boolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="isPrivate" ordered="false"
unique="false" lowerBound="1" eType="#/0/Boolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="id" ordered="false" unique="false"
lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="date" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="desc" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="data" ordered="false"
unique="false" lowerBound="1" eType="#/0/String"/>
</eClassifiers>
</ecore:EPackage>
</xmi:XMI>

--------------050308030205070009090208--
Re: [TENEO] NPE when trying to load an Ecore model containing EEnums [message #98858 is a reply to message #98770] Wed, 10 October 2007 07:15 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Hugo,
I tested this and it worked fine. I did the following: persist Bugzilla.ecore then retrieve it and
initialize a datastore with it.

The npe is here:
enumInstance = (EEnum) epack.getEClassifier(eclassifier);
which is after this line:
final EPackage epack = EPackage.Registry.INSTANCE.getEPackage(epackUri);

I think the epack is null because the epackage you retrieved from the datastore is not registered in
the global registry. So after retrieving an epackage from the datastore you have to call:
EPackage.Registry.INSTANCE.put(epack.getNsURI(), epack), before initializing the datastore with the
retrieved epackage.

gr. Martin

Hugo Bruneliere wrote:
> When trying to load an Ecore model (attached to this post) containing
> EENums and EAttributes having these EEnums as types, I get the following
> error:
>
> Caused by: java.lang.NullPointerException
> at
> org.eclipse.emf.teneo.hibernate.mapping.DynamicENumUserType. setParameterValues(DynamicENumUserType.java:171)
>
> at
> org.hibernate.type.TypeFactory.injectParameters(TypeFactory. java:551)
> at org.hibernate.type.CustomType.<init>(CustomType.java:67)
> at org.hibernate.type.TypeFactory.heuristicType(TypeFactory.jav a:246)
> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 60)
> at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
> at org.hibernate.mapping.Property.isValid(Property.java:185)
> at
> org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:410)
> at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
> at org.hibernate.cfg.Configuration.validate(Configuration.java: 1026)
> at
> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1211)
>
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:177)
>
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:88)
>
>
> I found several bugs into the Eclipse/EMFT/Teneo Bugzilla concerning
> EEnum (all are marked as fixed). But no one seems to corresponds exactly
> to my case.
>
> Have you got an idea about where do my problem come from?
>
> Best regards,
>
> Hugo
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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] NPE when trying to load an Ecore model containing EEnums [message #98873 is a reply to message #98858] Wed, 10 October 2007 13:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Hugo.Bruneliere.univ-nantes.fr

Martin Taal a écrit :
> Hi Hugo,

Hi Martin,

> I tested this and it worked fine. I did the following: persist
> Bugzilla.ecore then retrieve it and initialize a datastore with it.
>
> The npe is here:
> enumInstance = (EEnum) epack.getEClassifier(eclassifier);
> which is after this line:
> final EPackage epack =
> EPackage.Registry.INSTANCE.getEPackage(epackUri);
>
> I think the epack is null because the epackage you retrieved from the
> datastore is not registered in the global registry. So after retrieving
> an epackage from the datastore you have to call:
> EPackage.Registry.INSTANCE.put(epack.getNsURI(), epack), before
> initializing the datastore with the retrieved epackage.

Once again you're right, now it works ;-)

But my question is why I encounter this problem only when loading models
containing attributes having EEnums as type? When trying to load other
models it works even though I don't explicitly register the
corresponding EPackages to the global package registry...

Hugo

>
> gr. Martin
>
> Hugo Bruneliere wrote:
>> When trying to load an Ecore model (attached to this post) containing
>> EENums and EAttributes having these EEnums as types, I get the
>> following error:
>>
>> Caused by: java.lang.NullPointerException
>> at
>> org.eclipse.emf.teneo.hibernate.mapping.DynamicENumUserType. setParameterValues(DynamicENumUserType.java:171)
>>
>> at
>> org.hibernate.type.TypeFactory.injectParameters(TypeFactory. java:551)
>> at org.hibernate.type.CustomType.<init>(CustomType.java:67)
>> at org.hibernate.type.TypeFactory.heuristicType(TypeFactory.jav a:246)
>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 60)
>> at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
>> at org.hibernate.mapping.Property.isValid(Property.java:185)
>> at
>> org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:410)
>> at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
>> at org.hibernate.cfg.Configuration.validate(Configuration.java: 1026)
>> at
>> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1211)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:177)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:88)
>>
>>
>> I found several bugs into the Eclipse/EMFT/Teneo Bugzilla concerning
>> EEnum (all are marked as fixed). But no one seems to corresponds
>> exactly to my case.
>>
>> Have you got an idea about where do my problem come from?
>>
>> Best regards,
>>
>> Hugo
>>
>
>


--
--------------------------------------------------------
Hugo Bruneliere - R&D Engineer
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssiniere
44322 Nantes Cedex 3 - France
office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
EMail: Hugo.Bruneliere@univ-nantes.fr
http://www.sciences.univ-nantes.fr/lina/atl/
--------------------------------------------------------
Re: [TENEO] NPE when trying to load an Ecore model containing EEnums [message #98888 is a reply to message #98873] Wed, 10 October 2007 13:34 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Hugo,
The enumtype (added by Teneo) used for hibernate does an explicit search in the global epackage
registry therefor this 'error' is already visible during initialization. I think also with the other
non-enum epackages you would have encountered this issue sooner or later.

gr. Martin

Hugo Bruneliere wrote:
> Martin Taal a écrit :
>> Hi Hugo,
>
> Hi Martin,
>
>> I tested this and it worked fine. I did the following: persist
>> Bugzilla.ecore then retrieve it and initialize a datastore with it.
>>
>> The npe is here:
>> enumInstance = (EEnum) epack.getEClassifier(eclassifier);
>> which is after this line:
>> final EPackage epack =
>> EPackage.Registry.INSTANCE.getEPackage(epackUri);
>>
>> I think the epack is null because the epackage you retrieved from the
>> datastore is not registered in the global registry. So after
>> retrieving an epackage from the datastore you have to call:
>> EPackage.Registry.INSTANCE.put(epack.getNsURI(), epack), before
>> initializing the datastore with the retrieved epackage.
>
> Once again you're right, now it works ;-)
>
> But my question is why I encounter this problem only when loading models
> containing attributes having EEnums as type? When trying to load other
> models it works even though I don't explicitly register the
> corresponding EPackages to the global package registry...
>
> Hugo
>
>>
>> gr. Martin
>>
>> Hugo Bruneliere wrote:
>>> When trying to load an Ecore model (attached to this post) containing
>>> EENums and EAttributes having these EEnums as types, I get the
>>> following error:
>>>
>>> Caused by: java.lang.NullPointerException
>>> at
>>> org.eclipse.emf.teneo.hibernate.mapping.DynamicENumUserType. setParameterValues(DynamicENumUserType.java:171)
>>>
>>> at
>>> org.hibernate.type.TypeFactory.injectParameters(TypeFactory. java:551)
>>> at org.hibernate.type.CustomType.<init>(CustomType.java:67)
>>> at
>>> org.hibernate.type.TypeFactory.heuristicType(TypeFactory.jav a:246)
>>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 60)
>>> at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
>>> at org.hibernate.mapping.Property.isValid(Property.java:185)
>>> at
>>> org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:410)
>>> at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
>>> at org.hibernate.cfg.Configuration.validate(Configuration.java: 1026)
>>> at
>>> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1211)
>>>
>>> at
>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:177)
>>>
>>> at
>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:88)
>>>
>>>
>>> I found several bugs into the Eclipse/EMFT/Teneo Bugzilla concerning
>>> EEnum (all are marked as fixed). But no one seems to corresponds
>>> exactly to my case.
>>>
>>> Have you got an idea about where do my problem come from?
>>>
>>> Best regards,
>>>
>>> Hugo
>>>
>>
>>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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] NPE when trying to load an Ecore model containing EEnums [message #609957 is a reply to message #98770] Wed, 10 October 2007 07:15 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Hugo,
I tested this and it worked fine. I did the following: persist Bugzilla.ecore then retrieve it and
initialize a datastore with it.

The npe is here:
enumInstance = (EEnum) epack.getEClassifier(eclassifier);
which is after this line:
final EPackage epack = EPackage.Registry.INSTANCE.getEPackage(epackUri);

I think the epack is null because the epackage you retrieved from the datastore is not registered in
the global registry. So after retrieving an epackage from the datastore you have to call:
EPackage.Registry.INSTANCE.put(epack.getNsURI(), epack), before initializing the datastore with the
retrieved epackage.

gr. Martin

Hugo Bruneliere wrote:
> When trying to load an Ecore model (attached to this post) containing
> EENums and EAttributes having these EEnums as types, I get the following
> error:
>
> Caused by: java.lang.NullPointerException
> at
> org.eclipse.emf.teneo.hibernate.mapping.DynamicENumUserType. setParameterValues(DynamicENumUserType.java:171)
>
> at
> org.hibernate.type.TypeFactory.injectParameters(TypeFactory. java:551)
> at org.hibernate.type.CustomType.<init>(CustomType.java:67)
> at org.hibernate.type.TypeFactory.heuristicType(TypeFactory.jav a:246)
> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 60)
> at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
> at org.hibernate.mapping.Property.isValid(Property.java:185)
> at
> org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:410)
> at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
> at org.hibernate.cfg.Configuration.validate(Configuration.java: 1026)
> at
> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1211)
>
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:177)
>
> at
> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:88)
>
>
> I found several bugs into the Eclipse/EMFT/Teneo Bugzilla concerning
> EEnum (all are marked as fixed). But no one seems to corresponds exactly
> to my case.
>
> Have you got an idea about where do my problem come from?
>
> Best regards,
>
> Hugo
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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] NPE when trying to load an Ecore model containing EEnums [message #609960 is a reply to message #98858] Wed, 10 October 2007 13:23 Go to previous message
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 674
Registered: July 2009
Senior Member
Martin Taal a écrit :
> Hi Hugo,

Hi Martin,

> I tested this and it worked fine. I did the following: persist
> Bugzilla.ecore then retrieve it and initialize a datastore with it.
>
> The npe is here:
> enumInstance = (EEnum) epack.getEClassifier(eclassifier);
> which is after this line:
> final EPackage epack =
> EPackage.Registry.INSTANCE.getEPackage(epackUri);
>
> I think the epack is null because the epackage you retrieved from the
> datastore is not registered in the global registry. So after retrieving
> an epackage from the datastore you have to call:
> EPackage.Registry.INSTANCE.put(epack.getNsURI(), epack), before
> initializing the datastore with the retrieved epackage.

Once again you're right, now it works ;-)

But my question is why I encounter this problem only when loading models
containing attributes having EEnums as type? When trying to load other
models it works even though I don't explicitly register the
corresponding EPackages to the global package registry...

Hugo

>
> gr. Martin
>
> Hugo Bruneliere wrote:
>> When trying to load an Ecore model (attached to this post) containing
>> EENums and EAttributes having these EEnums as types, I get the
>> following error:
>>
>> Caused by: java.lang.NullPointerException
>> at
>> org.eclipse.emf.teneo.hibernate.mapping.DynamicENumUserType. setParameterValues(DynamicENumUserType.java:171)
>>
>> at
>> org.hibernate.type.TypeFactory.injectParameters(TypeFactory. java:551)
>> at org.hibernate.type.CustomType.<init>(CustomType.java:67)
>> at org.hibernate.type.TypeFactory.heuristicType(TypeFactory.jav a:246)
>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 60)
>> at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
>> at org.hibernate.mapping.Property.isValid(Property.java:185)
>> at
>> org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:410)
>> at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
>> at org.hibernate.cfg.Configuration.validate(Configuration.java: 1026)
>> at
>> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1211)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:177)
>>
>> at
>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:88)
>>
>>
>> I found several bugs into the Eclipse/EMFT/Teneo Bugzilla concerning
>> EEnum (all are marked as fixed). But no one seems to corresponds
>> exactly to my case.
>>
>> Have you got an idea about where do my problem come from?
>>
>> Best regards,
>>
>> Hugo
>>
>
>


--
--------------------------------------------------------
Hugo Bruneliere - R&D Engineer
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssiniere
44322 Nantes Cedex 3 - France
office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
EMail: Hugo.Bruneliere@univ-nantes.fr
http://www.sciences.univ-nantes.fr/lina/atl/
--------------------------------------------------------


--------------------------------------------------------
Hugo Bruneliere, PhD
NaoMod team (IMT Atlantique & LS2N-CNRS)
Nantes - France
--------------------------------------------------------
Re: [TENEO] NPE when trying to load an Ecore model containing EEnums [message #609962 is a reply to message #98873] Wed, 10 October 2007 13:34 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Hugo,
The enumtype (added by Teneo) used for hibernate does an explicit search in the global epackage
registry therefor this 'error' is already visible during initialization. I think also with the other
non-enum epackages you would have encountered this issue sooner or later.

gr. Martin

Hugo Bruneliere wrote:
> Martin Taal a écrit :
>> Hi Hugo,
>
> Hi Martin,
>
>> I tested this and it worked fine. I did the following: persist
>> Bugzilla.ecore then retrieve it and initialize a datastore with it.
>>
>> The npe is here:
>> enumInstance = (EEnum) epack.getEClassifier(eclassifier);
>> which is after this line:
>> final EPackage epack =
>> EPackage.Registry.INSTANCE.getEPackage(epackUri);
>>
>> I think the epack is null because the epackage you retrieved from the
>> datastore is not registered in the global registry. So after
>> retrieving an epackage from the datastore you have to call:
>> EPackage.Registry.INSTANCE.put(epack.getNsURI(), epack), before
>> initializing the datastore with the retrieved epackage.
>
> Once again you're right, now it works ;-)
>
> But my question is why I encounter this problem only when loading models
> containing attributes having EEnums as type? When trying to load other
> models it works even though I don't explicitly register the
> corresponding EPackages to the global package registry...
>
> Hugo
>
>>
>> gr. Martin
>>
>> Hugo Bruneliere wrote:
>>> When trying to load an Ecore model (attached to this post) containing
>>> EENums and EAttributes having these EEnums as types, I get the
>>> following error:
>>>
>>> Caused by: java.lang.NullPointerException
>>> at
>>> org.eclipse.emf.teneo.hibernate.mapping.DynamicENumUserType. setParameterValues(DynamicENumUserType.java:171)
>>>
>>> at
>>> org.hibernate.type.TypeFactory.injectParameters(TypeFactory. java:551)
>>> at org.hibernate.type.CustomType.<init>(CustomType.java:67)
>>> at
>>> org.hibernate.type.TypeFactory.heuristicType(TypeFactory.jav a:246)
>>> at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:2 60)
>>> at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:2 53)
>>> at org.hibernate.mapping.Property.isValid(Property.java:185)
>>> at
>>> org.hibernate.mapping.PersistentClass.validate(PersistentCla ss.java:410)
>>> at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
>>> at org.hibernate.cfg.Configuration.validate(Configuration.java: 1026)
>>> at
>>> org.hibernate.cfg.Configuration.buildSessionFactory(Configur ation.java:1211)
>>>
>>> at
>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.buildSess ionFactory(HbSessionDataStore.java:177)
>>>
>>> at
>>> org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initializ e(HbSessionDataStore.java:88)
>>>
>>>
>>> I found several bugs into the Eclipse/EMFT/Teneo Bugzilla concerning
>>> EEnum (all are marked as fixed). But no one seems to corresponds
>>> exactly to my case.
>>>
>>> Have you got an idea about where do my problem come from?
>>>
>>> Best regards,
>>>
>>> Hugo
>>>
>>
>>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
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:[Teneo] Quick Start stuck
Next Topic:[Teneo-EMF] SessionController - Multiple resources
Goto Forum:
  


Current Time: Thu Apr 25 09:13:44 GMT 2024

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

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

Back to the top