|
|
|
Re: [Texo] Abstract schema type is unknown [message #898353 is a reply to message #898323] |
Thu, 26 July 2012 09:13 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Hi Erdal,
The entity name is example_MyType. Texo has several options to control entity naming, as a default the eclass name is
used with the nsprefix of the epackage as a prefix. This to get the safest initial behavior (in case different eclasses
in different epackages have the same name, this happens).
So this url should work:
http://localhost:5190/com.example.myapp/jsonws?query=select t from example_MyType t
gr. Martin
On 07/26/2012 10:24 AM, Erdal Karaca wrote:
> Here is a snippet of what I think might be interesing:
>
>
> <orm:access>FIELD</orm:access>
> <orm:mapped-superclass access="FIELD" class="com.example.Identifiable">
> <orm:attributes>
> <orm:id name="id">
> <orm:generated-value strategy="AUTO"/>
> </orm:id>
> <orm:version access="FIELD" name="version">
> <orm:convert></orm:convert>
> </orm:version>
> </orm:attributes>
> </orm:mapped-superclass>
> <orm:entity class="com.example.MyType" name="example_MyType">
> <orm:attributes>
> <orm:basic name="name" optional="false"/>
> <orm:one-to-many name="typeModels">
> <orm:cascade>
> <orm:cascade-all/>
> </orm:cascade>
> </orm:one-to-many>
> </orm:attributes>
> </orm:entity>
>
>
> This is the persistence unit:
>
> <persistence-unit name="example-derby">
> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
> <mapping-file>META-INF/orm.xml</mapping-file>
> <properties>
> <property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.DerbyPlatform"/>
> <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
> <property name="javax.persistence.jdbc.url" value="jdbc:derby:d:/tmp/erby-db;create=true"/>
>
> <!-- EclipseLink should create the database schema automatically -->
> <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
> <property name="eclipselink.ddl-generation.output-mode" value="database" />
> </properties>
> </persistence-unit>
>
> Martin taal wrote on Wed, 25 July 2012 20:43
>> Hi Erdal,
>> Can you post the snippet from the orm.xml which contains the mapping for MyType? Or if you have generated with JPA
>> annotations post the MyType's java code.
>>
>> gr. Martin
>>
>> On 07/25/2012 04:12 PM, Erdal Karaca wrote:
>> > I am trying to query a specific object:
>> >
>> > http://localhost:5190/com.example.myapp/jsonws?query=select t from MyType t
>> >
>> > THe error:
>> >
>> > "message": "An exception occurred while creating a query in EntityManager: Exception Description: Problem compiling
>> > [select t from MyType t]. [14, 20] The abstract schema type 'MyType' is unknown."
>> >
>> > If I just query all objects using the following syntax, it works:
>> >
>> > http://localhost:5190/com.example.myapp/jsonws/MyType
>> >
>> > I have instructed Texo to "Generate Model Code" and "Generate EclipseLink ORM".
>> >
>> > What do I miss?
>> >
>>
>>
>> --
>>
>> 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@xxxxxxxx - mtaal@xxxxxxxx
>> Web: www.springsite.com - www.elver.org
>
>
--
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@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
|
|
|
|
Re: [Texo] Abstract schema type is unknown [message #898473 is a reply to message #898449] |
Thu, 26 July 2012 12:49 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
There are 2 ways:
1) http://wiki.eclipse.org/Texo/ORM_JPA_Options
(see the enforce unique names option)
2) using an annotation model:
http://wiki.eclipse.org/Texo/ORM_JPA_Annotations_Details
the annotation on epackage level allows you to control this, there are attributes for controlling name generation.
gr. Martin
On 07/26/2012 02:04 PM, Erdal Karaca wrote:
> Is it possible to switch off the entity name prefix by default (currently, there are no duplicate entity names) or do I
> have to set a name for each entity in the annotations model? The optimal config would just map the entity name to the
> EClass name.
>
> Thanks!
>
> Martin taal wrote on Thu, 26 July 2012 05:13
>> Hi Erdal,
>> The entity name is example_MyType. Texo has several options to control entity naming, as a default the eclass name is
>> used with the nsprefix of the epackage as a prefix. This to get the safest initial behavior (in case different
>> eclasses in different epackages have the same name, this happens).
>>
>> So this url should work:
>> http://localhost:5190/com.example.myapp/jsonws?query=select t from example_MyType t
>>
>> gr. Martin
>
>
--
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@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
|
|
|
|
Powered by
FUDForum. Page generated in 0.05036 seconds