Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Teneo custom type with parameters
Teneo custom type with parameters [message #486740] Fri, 18 September 2009 20:45 Go to next message
Eclipse UserFriend
Originally posted by: timoba.vsp.com

Hello all,

I am trying to define a custom hibernate type that takes parameters with
JPA annotations. Here is my schema:

> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema
> xmlns:xsd='http://www.w3.org/2001/XMLSchema'
> xmlns:ecore='http://www.eclipse.org/emf/2002/Ecore'
> xmlns:com.vsp.product.service.buspooledrating='http://buspooledrating.service.product.vsp.com'
> targetNamespace='http://buspooledrating.service.product.vsp.com'
> ecore:nsPrefix='com.vsp.product.service.buspooledrating'
> ecore:package='com.vsp.product.service.buspooledrating'
> elementFormDefault='qualified'
> xmlns:com.vsp.product.model='http://model.product.vsp.com'
>>
> <xsd:import namespace="http://model.product.vsp.com" schemaLocation="../../model/Copay.xsd" ></xsd:import>
> <xsd:annotation>
> <xsd:appinfo source="teneo.jpa">
> @TypeDef(
> name="CopayValueType",
> typeClass = com.vsp.hibernate.customType.Float_CopayValueType.class,
> parameters = {
> @Parameter(name = "AppliedTo", value="Visit"),
> @Parameter(name = "CoPayFrequency", value="perOccurrance"),
> @Parameter(name = "ApplyToDeductable", value="False")
> }
> )
> </xsd:appinfo>
> </xsd:annotation>
>
> <xsd:complexType name="CoPayCriteria">
> <xsd:annotation><xsd:appinfo source="teneo.jpa">
> @Table(name="RNQ4309T")
> </xsd:appinfo></xsd:annotation>
> <xsd:choice>
> <xsd:sequence>
> <xsd:element name="examCoPay" type="com.vsp.product.model:Copay" >
> <xsd:annotation>
> <xsd:appinfo source="teneo.jpa">
> @Column(name="CO_PAY_1_AMT")
> @Type(type="CopayValueType")
> </xsd:appinfo>
> </xsd:annotation>
> </xsd:element>
> </xsd:sequence>
> </xsd:choice>
> </xsd:complexType>
> </xsd:schema>

I get this error:
Exception in thread "main" java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.initialize(J9VMInternals.java:218)
at com.vsp.product.service.lfcquotecriteria.Create.main(Create. java:118)
Caused by:
org.eclipse.emf.teneo.annotations.parser.AnnotationParserExc eption: The
eclass: HbAnnotatedEReference does not have an efeature for Type

I am using Teneo 1.0.1 v200809150739, EMF 2.4.0.v200808251517, and
eclipse 3.4.2.R342.

TIA,

Tim
Re: Teneo custom type with parameters [message #486829 is a reply to message #486740] Sat, 19 September 2009 15:50 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Tim,
The typeClass attribute is a String (as the annotations are not real java annotations) and it should not have the .class
extension, so something like this:
@TypeDef(
name="CopayValueType",
typeClass = "com.vsp.hibernate.customType.Float_CopayValueType",
parameters = {
@Parameter(name = "AppliedTo", value="Visit"),
@Parameter(name = "CoPayFrequency", value="perOccurrance"),
@Parameter(name = "ApplyToDeductable", value="False")
}
)

gr. Martin

Tim Barthel wrote:
> Hello all,
>
> I am trying to define a custom hibernate type that takes parameters with
> JPA annotations. Here is my schema:
>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xsd:schema
>> xmlns:xsd='http://www.w3.org/2001/XMLSchema'
>> xmlns:ecore='http://www.eclipse.org/emf/2002/Ecore'
>> xmlns:com.vsp.product.service.buspooledrating='http://buspooledrating.service.product.vsp.com'
>>
>> targetNamespace='http://buspooledrating.service.product.vsp.com'
>> ecore:nsPrefix='com.vsp.product.service.buspooledrating'
>> ecore:package='com.vsp.product.service.buspooledrating'
>> elementFormDefault='qualified'
>> xmlns:com.vsp.product.model='http://model.product.vsp.com'
>>>
>> <xsd:import namespace="http://model.product.vsp.com"
>> schemaLocation="../../model/Copay.xsd" ></xsd:import>
>> <xsd:annotation>
>> <xsd:appinfo source="teneo.jpa">
>> @TypeDef(
>> name="CopayValueType",
>> typeClass =
>> com.vsp.hibernate.customType.Float_CopayValueType.class,
>> parameters = {
>> @Parameter(name = "AppliedTo", value="Visit"),
>> @Parameter(name = "CoPayFrequency",
>> value="perOccurrance"),
>> @Parameter(name = "ApplyToDeductable",
>> value="False")
>> }
>> )
>> </xsd:appinfo>
>> </xsd:annotation>
>>
>> <xsd:complexType name="CoPayCriteria">
>> <xsd:annotation><xsd:appinfo source="teneo.jpa">
>> @Table(name="RNQ4309T")
>> </xsd:appinfo></xsd:annotation>
>> <xsd:choice>
>> <xsd:sequence>
>> <xsd:element name="examCoPay"
>> type="com.vsp.product.model:Copay" >
>> <xsd:annotation>
>> <xsd:appinfo source="teneo.jpa">
>> @Column(name="CO_PAY_1_AMT")
>> @Type(type="CopayValueType")
>> </xsd:appinfo>
>> </xsd:annotation>
>> </xsd:element>
>> </xsd:sequence>
>> </xsd:choice>
>> </xsd:complexType>
>> </xsd:schema>
>
> I get this error:
> Exception in thread "main" java.lang.ExceptionInInitializerError
> at java.lang.J9VMInternals.initialize(J9VMInternals.java:218)
> at
> com.vsp.product.service.lfcquotecriteria.Create.main(Create. java:118)
> Caused by:
> org.eclipse.emf.teneo.annotations.parser.AnnotationParserExc eption: The
> eclass: HbAnnotatedEReference does not have an efeature for Type
>
> I am using Teneo 1.0.1 v200809150739, EMF 2.4.0.v200808251517, and
> eclipse 3.4.2.R342.
>
> TIA,
>
> Tim


--

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 custom type with parameters [message #487354 is a reply to message #486740] Tue, 22 September 2009 20:22 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Tim,
I tried this annotation in Teneo 1.0.4 and it worked for me:
@TypeDef(
name="CopayValueType",
typeClass = "com.vsp.hibernate.customType.Float_CopayValueType",
parameters = {
@Parameter(name = "AppliedTo", value="Visit"),
@Parameter(name = "CoPayFrequency", value="perOccurrance"),
@Parameter(name = "ApplyToDeductable", value="False")
}
)

At least it failed with me on that the com.vsp.hibernate.customType.Float_CopayValueType was not known but that was when
initializing Hibernate (so later than your exception) and logical (as I don't have this class).

So can you upgrade to 1.0.4 and try again?

gr. Martin

Tim Barthel wrote:
> Hello all,
>
> I am trying to define a custom hibernate type that takes parameters with
> JPA annotations. Here is my schema:
>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xsd:schema
>> xmlns:xsd='http://www.w3.org/2001/XMLSchema'
>> xmlns:ecore='http://www.eclipse.org/emf/2002/Ecore'
>> xmlns:com.vsp.product.service.buspooledrating='http://buspooledrating.service.product.vsp.com'
>>
>> targetNamespace='http://buspooledrating.service.product.vsp.com'
>> ecore:nsPrefix='com.vsp.product.service.buspooledrating'
>> ecore:package='com.vsp.product.service.buspooledrating'
>> elementFormDefault='qualified'
>> xmlns:com.vsp.product.model='http://model.product.vsp.com'
>>>
>> <xsd:import namespace="http://model.product.vsp.com"
>> schemaLocation="../../model/Copay.xsd" ></xsd:import>
>> <xsd:annotation>
>> <xsd:appinfo source="teneo.jpa">
>> @TypeDef(
>> name="CopayValueType",
>> typeClass =
>> com.vsp.hibernate.customType.Float_CopayValueType.class,
>> parameters = {
>> @Parameter(name = "AppliedTo", value="Visit"),
>> @Parameter(name = "CoPayFrequency",
>> value="perOccurrance"),
>> @Parameter(name = "ApplyToDeductable",
>> value="False")
>> }
>> )
>> </xsd:appinfo>
>> </xsd:annotation>
>>
>> <xsd:complexType name="CoPayCriteria">
>> <xsd:annotation><xsd:appinfo source="teneo.jpa">
>> @Table(name="RNQ4309T")
>> </xsd:appinfo></xsd:annotation>
>> <xsd:choice>
>> <xsd:sequence>
>> <xsd:element name="examCoPay"
>> type="com.vsp.product.model:Copay" >
>> <xsd:annotation>
>> <xsd:appinfo source="teneo.jpa">
>> @Column(name="CO_PAY_1_AMT")
>> @Type(type="CopayValueType")
>> </xsd:appinfo>
>> </xsd:annotation>
>> </xsd:element>
>> </xsd:sequence>
>> </xsd:choice>
>> </xsd:complexType>
>> </xsd:schema>
>
> I get this error:
> Exception in thread "main" java.lang.ExceptionInInitializerError
> at java.lang.J9VMInternals.initialize(J9VMInternals.java:218)
> at
> com.vsp.product.service.lfcquotecriteria.Create.main(Create. java:118)
> Caused by:
> org.eclipse.emf.teneo.annotations.parser.AnnotationParserExc eption: The
> eclass: HbAnnotatedEReference does not have an efeature for Type
>
> I am using Teneo 1.0.1 v200809150739, EMF 2.4.0.v200808251517, and
> eclipse 3.4.2.R342.
>
> TIA,
>
> Tim


--

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:Unable to load mixed content when loading an ecore model derived from an xml schema
Next Topic:Saving correctly a model with references
Goto Forum:
  


Current Time: Thu Mar 28 15:02:31 GMT 2024

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

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

Back to the top