Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Teneo+hibernate]
[Teneo+hibernate] [message #81661] Wed, 02 May 2007 07:36 Go to next message
Roman Bliznets is currently offline Roman BliznetsFriend
Messages: 75
Registered: July 2009
Member
Hello.
I'm use emf 2.3.0.v200703291501, teneo 0.8.0.v200704230019, hibernate 3.2,
database MySQL.
I convert XSD into Ecore model. After
Teneo maps Ecore into database wrong.

Wrong column types.

First Problem:
in XSD:
<xs:simpleType name="Count2Type">
<xs:annotation>
<xs:documentation>Number. form 1. to 2 digit. </xs:documentation>
</xs:annotation>
<xs:restriction base="CategoryCust:IntegerCategoriesCust">
<xs:totalDigits value="2"/>
<xs:minInclusive value="1"/>
</xs:restriction>
</xs:simpleType>
in DataBase type of column: DECIMAL(2,2) (should be DECIMAL(2,0))
I take xml mapping (hbds.getMappingXML();) from datastore
---
<property name="subLineNumber" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.math.BigInteger">
<column not-null="false" unique="false" name="`sublinenumber`"
precision="2"/>
</property>
---

Second Problem:
in XSD:
<xs:simpleType name="Code2Type">
<xs:annotation>
<xs:documentation>Code. 2 symbols</xs:documentation>
</xs:annotation>
<xs:restriction base="CategoryCust:CodeCategoriesCust">
<xs:length value="2"/>
</xs:restriction>
</xs:simpleType>
in DataBase type of column: varchar(1) (should be varchar(2)) but not for
every column;
in xml mapping:
---
<property name="goodsStatus" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`goodsstatus`"
length="2"/>
</property>
---

Where is problem in Teneo or Hibernate?
P.S All types in Ecore equal to all types in XSD.
Re: [Teneo+hibernate] [message #81676 is a reply to message #81661] Wed, 02 May 2007 07:52 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
It seems that the problem is in Hibernate. Possibly the mapping logic of Teneo can be adapted to
give hibernate the right hints.
Can you try with log4j set to debugging? Then you can see how hibernate creates the tables in the
beginning, maybe this gives some more information.

You can manually change the mapping and see what works for you. If you post the updated mapping then
I can see how to adapt the mapping logic.

gr. Martin

wolf_roma wrote:
> Hello.
> I'm use emf 2.3.0.v200703291501, teneo 0.8.0.v200704230019, hibernate 3.2,
> database MySQL.
> I convert XSD into Ecore model. After
> Teneo maps Ecore into database wrong.
>
> Wrong column types.
>
> First Problem:
> in XSD:
> <xs:simpleType name="Count2Type">
> <xs:annotation>
> <xs:documentation>Number. form 1. to 2 digit. </xs:documentation>
> </xs:annotation>
> <xs:restriction base="CategoryCust:IntegerCategoriesCust">
> <xs:totalDigits value="2"/>
> <xs:minInclusive value="1"/>
> </xs:restriction>
> </xs:simpleType>
> in DataBase type of column: DECIMAL(2,2) (should be DECIMAL(2,0))
> I take xml mapping (hbds.getMappingXML();) from datastore
> ---
> <property name="subLineNumber" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.math.BigInteger">
> <column not-null="false" unique="false" name="`sublinenumber`"
> precision="2"/>
> </property>
> ---
>
> Second Problem:
> in XSD:
> <xs:simpleType name="Code2Type">
> <xs:annotation>
> <xs:documentation>Code. 2 symbols</xs:documentation>
> </xs:annotation>
> <xs:restriction base="CategoryCust:CodeCategoriesCust">
> <xs:length value="2"/>
> </xs:restriction>
> </xs:simpleType>
> in DataBase type of column: varchar(1) (should be varchar(2)) but not for
> every column;
> in xml mapping:
> ---
> <property name="goodsStatus" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`goodsstatus`"
> length="2"/>
> </property>
> ---
>
> Where is problem in Teneo or Hibernate?
> P.S All types in Ecore equal to all types in XSD.
>
>


--

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+hibernate] [message #81690 is a reply to message #81676] Wed, 02 May 2007 08:53 Go to previous messageGo to next message
Roman Bliznets is currently offline Roman BliznetsFriend
Messages: 75
Registered: July 2009
Member
Ok, I set Log4j in debug mode;
First problem:
It solved if I manual add attribute: scale="0";

Second Problem:
in xml mapping:
<property name="goodsStatus" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`goodsstatus`" length="2"/>
</property>
<property name="repairStatus" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`repairstatus`"
length="2"/>
</property>

from log:
5157 [main] DEBUG org.hibernate.tool.hbm2ddl.SchemaUpdate - create table
`documentbasetype` (e_id bigint not null auto_increment, `dtype`
varchar(255) not null, e_version integer not null, `prdocumentname`
varchar(250), `prdocumentnumber` varchar(50), `prdocumentdate` varchar(255),
`complationauthoritydate` varchar(255), `linenumber` numeric(2,0),
`sublinenumber` varchar(2), `documentmodecode` varchar(4), `informationcode`
varchar(2), `perioddate` varchar(255), `conditiondate` varchar(255),
`saledate` varchar(255), `presentingdate` varchar(255), `goodsstatus`
varchar(1), `repairstatus` bit, `documentbeginactionsdat` varchar(255),
`documentendactionsdate` varchar(255), `organizationname` varchar(150),
`presentinglackingdate` varchar(255), `presenteddocumentmodecode`
varchar(4), `actnumber` varchar(50), `actdate` varchar(255),
`privelegedocumentmodecode` varchar(2), `excisemarkingmodecodetype`
varchar(1), `customspaymentmodecodetyp` varchar(2), `symbolsublinenumber`
varchar(1), `supplystatus` varchar(2), `exportdate` varchar(255),
`esadoutpresenteddocume_id` bigint, `esadoutpresenteddocum_idx` integer,
`esadcontractlisttype_a_id` bigint, `esadcontractlisttype__idx` integer,
econtainer_class varchar(255), e_container varchar(255),
e_container_featureid integer, primary key (e_id))

`goodsstatus` varchar(1) - should be varchar(2)
`repairstatus` bit - it big wrong :), should be varchar(2)
Another fields right;

May be I have to use definite Hibernate?
Can I take Teneo mapping and use it without Teneo? (How to do?)
Should I post in Hibernate.org about the bug?

you wrote:
> Hi,
> It seems that the problem is in Hibernate. Possibly the mapping logic of
> Teneo can be adapted to give hibernate the right hints.
> Can you try with log4j set to debugging? Then you can see how hibernate
> creates the tables in the beginning, maybe this gives some more
> information.
>
> You can manually change the mapping and see what works for you. If you
> post the updated mapping then I can see how to adapt the mapping logic.
>
> gr. Martin
>
Re: [Teneo+hibernate] [message #81705 is a reply to message #81690] Wed, 02 May 2007 09:05 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
The repairstatus is even more strange, is there by accident another eclass which also has a
repairstatus which is of another type (boolean)?

You can use the hbm in combination with Teneo. In this case Teneo will not do any automatic mapping
but will use the hbm file. See the option: PersistenceOptions.USE_MAPPING_FILE, here:
http://www.elver.org/hibernate/options.html

I would upgrade to the latest version of hibernate. Although I would surprised if that is the issue
here.

Can you try a join table mapping strategy? See the option:
PersistenceOptions.INHERITANCE_MAPPING

gr. Martin

wolf_roma wrote:
> Ok, I set Log4j in debug mode;
> First problem:
> It solved if I manual add attribute: scale="0";
>
> Second Problem:
> in xml mapping:
> <property name="goodsStatus" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`goodsstatus`" length="2"/>
> </property>
> <property name="repairStatus" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`repairstatus`"
> length="2"/>
> </property>
>
> from log:
> 5157 [main] DEBUG org.hibernate.tool.hbm2ddl.SchemaUpdate - create table
> `documentbasetype` (e_id bigint not null auto_increment, `dtype`
> varchar(255) not null, e_version integer not null, `prdocumentname`
> varchar(250), `prdocumentnumber` varchar(50), `prdocumentdate` varchar(255),
> `complationauthoritydate` varchar(255), `linenumber` numeric(2,0),
> `sublinenumber` varchar(2), `documentmodecode` varchar(4), `informationcode`
> varchar(2), `perioddate` varchar(255), `conditiondate` varchar(255),
> `saledate` varchar(255), `presentingdate` varchar(255), `goodsstatus`
> varchar(1), `repairstatus` bit, `documentbeginactionsdat` varchar(255),
> `documentendactionsdate` varchar(255), `organizationname` varchar(150),
> `presentinglackingdate` varchar(255), `presenteddocumentmodecode`
> varchar(4), `actnumber` varchar(50), `actdate` varchar(255),
> `privelegedocumentmodecode` varchar(2), `excisemarkingmodecodetype`
> varchar(1), `customspaymentmodecodetyp` varchar(2), `symbolsublinenumber`
> varchar(1), `supplystatus` varchar(2), `exportdate` varchar(255),
> `esadoutpresenteddocume_id` bigint, `esadoutpresenteddocum_idx` integer,
> `esadcontractlisttype_a_id` bigint, `esadcontractlisttype__idx` integer,
> econtainer_class varchar(255), e_container varchar(255),
> e_container_featureid integer, primary key (e_id))
>
> `goodsstatus` varchar(1) - should be varchar(2)
> `repairstatus` bit - it big wrong :), should be varchar(2)
> Another fields right;
>
> May be I have to use definite Hibernate?
> Can I take Teneo mapping and use it without Teneo? (How to do?)
> Should I post in Hibernate.org about the bug?
>
> you wrote:
>> Hi,
>> It seems that the problem is in Hibernate. Possibly the mapping logic of
>> Teneo can be adapted to give hibernate the right hints.
>> Can you try with log4j set to debugging? Then you can see how hibernate
>> creates the tables in the beginning, maybe this gives some more
>> information.
>>
>> You can manually change the mapping and see what works for you. If you
>> post the updated mapping then I can see how to adapt the mapping logic.
>>
>> gr. Martin
>>
>
>


--

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+hibernate] [message #81766 is a reply to message #81705] Wed, 02 May 2007 15:06 Go to previous messageGo to next message
Roman Bliznets is currently offline Roman BliznetsFriend
Messages: 75
Registered: July 2009
Member
I'm try to use PersistenceOptions.INHERITANCE_MAPPING and it solve my
problem with columnb types; (Same parent class has two children class with
identical filednames.)

I have another problem:
Hibernate: insert into goodsDescription (`processinggoodstype_go_id`,
`processinggoodstype_g_idx`, elt) values (?, ?, ?)
10781 [main] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error:
1364, SQLState: HY000
10781 [main] ERROR org.hibernate.util.JDBCExceptionReporter - Field
'goodsitembasetype_good_id' doesn't have a default value

List of varchar(250) (goodsDescription) is used in some comlex types;

In sql:
create table goodsDescription (
`goodsitembasetype_good_id` bigint not null,
elt varchar(255),
`goodsitembasetype_goo_idx` integer not null,
`goodsbasetype_goodsdes_id` bigint not null,
`goodsbasetype_goodsde_idx` integer not null,
`goodsgroupdescriptiont_id` bigint not null,
`goodsgroupdescription_idx` integer not null,
`processinggoodstype_go_id` bigint not null,
`processinggoodstype_g_idx` integer not null,
primary key (`processinggoodstype_go_id`,
`processinggoodstype_g_idx`)
)


What me to do?
Most probably that this is Hibernate mistake, but
I don't understand how fix it...

May be i send you my project?
Re: [Teneo+hibernate] [message #81780 is a reply to message #81766] Wed, 02 May 2007 15:15 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Can you just send me the ecore and the hbm files? This should be enough for me to look at.

gr. Martin

wolf_roma wrote:
> I'm try to use PersistenceOptions.INHERITANCE_MAPPING and it solve my
> problem with columnb types; (Same parent class has two children class with
> identical filednames.)
>
> I have another problem:
> Hibernate: insert into goodsDescription (`processinggoodstype_go_id`,
> `processinggoodstype_g_idx`, elt) values (?, ?, ?)
> 10781 [main] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error:
> 1364, SQLState: HY000
> 10781 [main] ERROR org.hibernate.util.JDBCExceptionReporter - Field
> 'goodsitembasetype_good_id' doesn't have a default value
>
> List of varchar(250) (goodsDescription) is used in some comlex types;
>
> In sql:
> create table goodsDescription (
> `goodsitembasetype_good_id` bigint not null,
> elt varchar(255),
> `goodsitembasetype_goo_idx` integer not null,
> `goodsbasetype_goodsdes_id` bigint not null,
> `goodsbasetype_goodsde_idx` integer not null,
> `goodsgroupdescriptiont_id` bigint not null,
> `goodsgroupdescription_idx` integer not null,
> `processinggoodstype_go_id` bigint not null,
> `processinggoodstype_g_idx` integer not null,
> primary key (`processinggoodstype_go_id`,
> `processinggoodstype_g_idx`)
> )
>
>
> What me to do?
> Most probably that this is Hibernate mistake, but
> I don't understand how fix it...
>
> May be i send you my project?
>
>


--

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+hibernate] [message #81796 is a reply to message #81780] Thu, 03 May 2007 10:05 Go to previous messageGo to next message
Roman Bliznets is currently offline Roman BliznetsFriend
Messages: 75
Registered: July 2009
Member
Hello, Martin.
Some description:
xsdtest - Ecore model
in xsdtest.test project:
customs.ru.categories._3._0._0.tests._0Example - main class
test.QuickStart - class which provides SessionFactory
test.xml - input xml


  • Attachment: w2.rar
    (Size: 462.35KB, Downloaded 108 times)
Re: [Teneo+hibernate] [message #81845 is a reply to message #81796] Fri, 04 May 2007 06:23 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020906080109030003060303
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I checked and there are several types which use the same eattribute name for a many eattribute. This
results in one jointable called goodsDescription (which stores the values of the eattribute) which
is created/used for all these occurences. This is a missing feature of Teneo. Teneo should choose a
unique join table name (for one-to-many ereferences this is done, but not yet for many eattributes).
Can you enter a bugzilla for this?
This will be solved in the next release (which will be in a few weeks).

In the mean time you can set the join table name through annotations. This has to be done for each
occurence of the eattribute with a name-clash (and which has many=true). I attached an example xml
to do that for one for one eclass. This xml should be put in the source tree (classpath) and the
classpath location (incl. filename) should be passed to teneo using the
PersistenceOptions.PERSISTENCE_XML option. What you will see is that a jointable with name
'myuniquename' is created.

I checked and there are at least two other eattribute names which are being used by multiple
eclasses for a many-eattribute:
AutoMotoParametersType
ProcessingGoodsDeclarationType

but maybe there are more.

gr. Martin

wolf_roma wrote:
> Hello, Martin.
> Some description:
> xsdtest - Ecore model
> in xsdtest.test project:
> customs.ru.categories._3._0._0.tests._0Example - main class
> test.QuickStart - class which provides SessionFactory
> test.xml - input xml
>
>


--

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

--------------020906080109030003060303
Content-Type: text/xml;
name="test.persistence.xml"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="test.persistence.xml"

<?xml version="1.0" encoding="utf-8"?>
<persistence-mapping xmlns="http://www.eclipse.org/emft/teneo"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<epackage
namespace-uri="urn:customs.ru:ESADCommonAggregateTypes:3.0.1 ">
<eclass name="GoodsItemBaseType">
<property name="goodsDescription">
<join-table name="myuniquename"/>
</property>
</eclass>
</epackage>

</persistence-mapping>
--------------020906080109030003060303--
Re: [Teneo+hibernate] [message #81860 is a reply to message #81845] Fri, 04 May 2007 07:33 Go to previous messageGo to next message
Roman Bliznets is currently offline Roman BliznetsFriend
Messages: 75
Registered: July 2009
Member
Thanks. I will be use PersistenceOptions.PERSISTENCE_XML before release next
Teneo version.
I see what you already create issue in bugzilla (183563), it dosn't?
Re: [Teneo+hibernate] [message #81875 is a reply to message #81860] Fri, 04 May 2007 07:52 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi, no this is a different issue (although related) can you create a new bugzilla?
Can you also include a hyperlink to the newsgroup discussion then that would help others who see the
issue?
Thanks.

gr. Martin

wolf_roma wrote:
> Thanks. I will be use PersistenceOptions.PERSISTENCE_XML before release next
> Teneo version.
> I see what you already create issue in bugzilla (183563), it dosn't?
>
>
>


--

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+hibernate] [message #82244 is a reply to message #81875] Mon, 07 May 2007 07:11 Go to previous message
Roman Bliznets is currently offline Roman BliznetsFriend
Messages: 75
Registered: July 2009
Member
I create issue 185717
https://bugs.eclipse.org/bugs/show_bug.cgi?id=185717
If I did mistake then sorry.
Re: [Teneo+hibernate] [message #605185 is a reply to message #81661] Wed, 02 May 2007 07:52 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
It seems that the problem is in Hibernate. Possibly the mapping logic of Teneo can be adapted to
give hibernate the right hints.
Can you try with log4j set to debugging? Then you can see how hibernate creates the tables in the
beginning, maybe this gives some more information.

You can manually change the mapping and see what works for you. If you post the updated mapping then
I can see how to adapt the mapping logic.

gr. Martin

wolf_roma wrote:
> Hello.
> I'm use emf 2.3.0.v200703291501, teneo 0.8.0.v200704230019, hibernate 3.2,
> database MySQL.
> I convert XSD into Ecore model. After
> Teneo maps Ecore into database wrong.
>
> Wrong column types.
>
> First Problem:
> in XSD:
> <xs:simpleType name="Count2Type">
> <xs:annotation>
> <xs:documentation>Number. form 1. to 2 digit. </xs:documentation>
> </xs:annotation>
> <xs:restriction base="CategoryCust:IntegerCategoriesCust">
> <xs:totalDigits value="2"/>
> <xs:minInclusive value="1"/>
> </xs:restriction>
> </xs:simpleType>
> in DataBase type of column: DECIMAL(2,2) (should be DECIMAL(2,0))
> I take xml mapping (hbds.getMappingXML();) from datastore
> ---
> <property name="subLineNumber" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.math.BigInteger">
> <column not-null="false" unique="false" name="`sublinenumber`"
> precision="2"/>
> </property>
> ---
>
> Second Problem:
> in XSD:
> <xs:simpleType name="Code2Type">
> <xs:annotation>
> <xs:documentation>Code. 2 symbols</xs:documentation>
> </xs:annotation>
> <xs:restriction base="CategoryCust:CodeCategoriesCust">
> <xs:length value="2"/>
> </xs:restriction>
> </xs:simpleType>
> in DataBase type of column: varchar(1) (should be varchar(2)) but not for
> every column;
> in xml mapping:
> ---
> <property name="goodsStatus" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`goodsstatus`"
> length="2"/>
> </property>
> ---
>
> Where is problem in Teneo or Hibernate?
> P.S All types in Ecore equal to all types in XSD.
>
>


--

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+hibernate] [message #605189 is a reply to message #81676] Wed, 02 May 2007 08:53 Go to previous message
Roman Bliznets is currently offline Roman BliznetsFriend
Messages: 75
Registered: July 2009
Member
Ok, I set Log4j in debug mode;
First problem:
It solved if I manual add attribute: scale="0";

Second Problem:
in xml mapping:
<property name="goodsStatus" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`goodsstatus`" length="2"/>
</property>
<property name="repairStatus" lazy="false" insert="true" update="true"
not-null="false" unique="false" type="java.lang.String">
<column not-null="false" unique="false" name="`repairstatus`"
length="2"/>
</property>

from log:
5157 [main] DEBUG org.hibernate.tool.hbm2ddl.SchemaUpdate - create table
`documentbasetype` (e_id bigint not null auto_increment, `dtype`
varchar(255) not null, e_version integer not null, `prdocumentname`
varchar(250), `prdocumentnumber` varchar(50), `prdocumentdate` varchar(255),
`complationauthoritydate` varchar(255), `linenumber` numeric(2,0),
`sublinenumber` varchar(2), `documentmodecode` varchar(4), `informationcode`
varchar(2), `perioddate` varchar(255), `conditiondate` varchar(255),
`saledate` varchar(255), `presentingdate` varchar(255), `goodsstatus`
varchar(1), `repairstatus` bit, `documentbeginactionsdat` varchar(255),
`documentendactionsdate` varchar(255), `organizationname` varchar(150),
`presentinglackingdate` varchar(255), `presenteddocumentmodecode`
varchar(4), `actnumber` varchar(50), `actdate` varchar(255),
`privelegedocumentmodecode` varchar(2), `excisemarkingmodecodetype`
varchar(1), `customspaymentmodecodetyp` varchar(2), `symbolsublinenumber`
varchar(1), `supplystatus` varchar(2), `exportdate` varchar(255),
`esadoutpresenteddocume_id` bigint, `esadoutpresenteddocum_idx` integer,
`esadcontractlisttype_a_id` bigint, `esadcontractlisttype__idx` integer,
econtainer_class varchar(255), e_container varchar(255),
e_container_featureid integer, primary key (e_id))

`goodsstatus` varchar(1) - should be varchar(2)
`repairstatus` bit - it big wrong :), should be varchar(2)
Another fields right;

May be I have to use definite Hibernate?
Can I take Teneo mapping and use it without Teneo? (How to do?)
Should I post in Hibernate.org about the bug?

you wrote:
> Hi,
> It seems that the problem is in Hibernate. Possibly the mapping logic of
> Teneo can be adapted to give hibernate the right hints.
> Can you try with log4j set to debugging? Then you can see how hibernate
> creates the tables in the beginning, maybe this gives some more
> information.
>
> You can manually change the mapping and see what works for you. If you
> post the updated mapping then I can see how to adapt the mapping logic.
>
> gr. Martin
>
Re: [Teneo+hibernate] [message #605191 is a reply to message #81690] Wed, 02 May 2007 09:05 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
The repairstatus is even more strange, is there by accident another eclass which also has a
repairstatus which is of another type (boolean)?

You can use the hbm in combination with Teneo. In this case Teneo will not do any automatic mapping
but will use the hbm file. See the option: PersistenceOptions.USE_MAPPING_FILE, here:
http://www.elver.org/hibernate/options.html

I would upgrade to the latest version of hibernate. Although I would surprised if that is the issue
here.

Can you try a join table mapping strategy? See the option:
PersistenceOptions.INHERITANCE_MAPPING

gr. Martin

wolf_roma wrote:
> Ok, I set Log4j in debug mode;
> First problem:
> It solved if I manual add attribute: scale="0";
>
> Second Problem:
> in xml mapping:
> <property name="goodsStatus" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`goodsstatus`" length="2"/>
> </property>
> <property name="repairStatus" lazy="false" insert="true" update="true"
> not-null="false" unique="false" type="java.lang.String">
> <column not-null="false" unique="false" name="`repairstatus`"
> length="2"/>
> </property>
>
> from log:
> 5157 [main] DEBUG org.hibernate.tool.hbm2ddl.SchemaUpdate - create table
> `documentbasetype` (e_id bigint not null auto_increment, `dtype`
> varchar(255) not null, e_version integer not null, `prdocumentname`
> varchar(250), `prdocumentnumber` varchar(50), `prdocumentdate` varchar(255),
> `complationauthoritydate` varchar(255), `linenumber` numeric(2,0),
> `sublinenumber` varchar(2), `documentmodecode` varchar(4), `informationcode`
> varchar(2), `perioddate` varchar(255), `conditiondate` varchar(255),
> `saledate` varchar(255), `presentingdate` varchar(255), `goodsstatus`
> varchar(1), `repairstatus` bit, `documentbeginactionsdat` varchar(255),
> `documentendactionsdate` varchar(255), `organizationname` varchar(150),
> `presentinglackingdate` varchar(255), `presenteddocumentmodecode`
> varchar(4), `actnumber` varchar(50), `actdate` varchar(255),
> `privelegedocumentmodecode` varchar(2), `excisemarkingmodecodetype`
> varchar(1), `customspaymentmodecodetyp` varchar(2), `symbolsublinenumber`
> varchar(1), `supplystatus` varchar(2), `exportdate` varchar(255),
> `esadoutpresenteddocume_id` bigint, `esadoutpresenteddocum_idx` integer,
> `esadcontractlisttype_a_id` bigint, `esadcontractlisttype__idx` integer,
> econtainer_class varchar(255), e_container varchar(255),
> e_container_featureid integer, primary key (e_id))
>
> `goodsstatus` varchar(1) - should be varchar(2)
> `repairstatus` bit - it big wrong :), should be varchar(2)
> Another fields right;
>
> May be I have to use definite Hibernate?
> Can I take Teneo mapping and use it without Teneo? (How to do?)
> Should I post in Hibernate.org about the bug?
>
> you wrote:
>> Hi,
>> It seems that the problem is in Hibernate. Possibly the mapping logic of
>> Teneo can be adapted to give hibernate the right hints.
>> Can you try with log4j set to debugging? Then you can see how hibernate
>> creates the tables in the beginning, maybe this gives some more
>> information.
>>
>> You can manually change the mapping and see what works for you. If you
>> post the updated mapping then I can see how to adapt the mapping logic.
>>
>> gr. Martin
>>
>
>


--

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+hibernate] [message #605203 is a reply to message #81705] Wed, 02 May 2007 15:06 Go to previous message
Roman Bliznets is currently offline Roman BliznetsFriend
Messages: 75
Registered: July 2009
Member
I'm try to use PersistenceOptions.INHERITANCE_MAPPING and it solve my
problem with columnb types; (Same parent class has two children class with
identical filednames.)

I have another problem:
Hibernate: insert into goodsDescription (`processinggoodstype_go_id`,
`processinggoodstype_g_idx`, elt) values (?, ?, ?)
10781 [main] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error:
1364, SQLState: HY000
10781 [main] ERROR org.hibernate.util.JDBCExceptionReporter - Field
'goodsitembasetype_good_id' doesn't have a default value

List of varchar(250) (goodsDescription) is used in some comlex types;

In sql:
create table goodsDescription (
`goodsitembasetype_good_id` bigint not null,
elt varchar(255),
`goodsitembasetype_goo_idx` integer not null,
`goodsbasetype_goodsdes_id` bigint not null,
`goodsbasetype_goodsde_idx` integer not null,
`goodsgroupdescriptiont_id` bigint not null,
`goodsgroupdescription_idx` integer not null,
`processinggoodstype_go_id` bigint not null,
`processinggoodstype_g_idx` integer not null,
primary key (`processinggoodstype_go_id`,
`processinggoodstype_g_idx`)
)


What me to do?
Most probably that this is Hibernate mistake, but
I don't understand how fix it...

May be i send you my project?
Re: [Teneo+hibernate] [message #605206 is a reply to message #81766] Wed, 02 May 2007 15:15 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Can you just send me the ecore and the hbm files? This should be enough for me to look at.

gr. Martin

wolf_roma wrote:
> I'm try to use PersistenceOptions.INHERITANCE_MAPPING and it solve my
> problem with columnb types; (Same parent class has two children class with
> identical filednames.)
>
> I have another problem:
> Hibernate: insert into goodsDescription (`processinggoodstype_go_id`,
> `processinggoodstype_g_idx`, elt) values (?, ?, ?)
> 10781 [main] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error:
> 1364, SQLState: HY000
> 10781 [main] ERROR org.hibernate.util.JDBCExceptionReporter - Field
> 'goodsitembasetype_good_id' doesn't have a default value
>
> List of varchar(250) (goodsDescription) is used in some comlex types;
>
> In sql:
> create table goodsDescription (
> `goodsitembasetype_good_id` bigint not null,
> elt varchar(255),
> `goodsitembasetype_goo_idx` integer not null,
> `goodsbasetype_goodsdes_id` bigint not null,
> `goodsbasetype_goodsde_idx` integer not null,
> `goodsgroupdescriptiont_id` bigint not null,
> `goodsgroupdescription_idx` integer not null,
> `processinggoodstype_go_id` bigint not null,
> `processinggoodstype_g_idx` integer not null,
> primary key (`processinggoodstype_go_id`,
> `processinggoodstype_g_idx`)
> )
>
>
> What me to do?
> Most probably that this is Hibernate mistake, but
> I don't understand how fix it...
>
> May be i send you my project?
>
>


--

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+hibernate] [message #605210 is a reply to message #81780] Thu, 03 May 2007 10:05 Go to previous message
Roman Bliznets is currently offline Roman BliznetsFriend
Messages: 75
Registered: July 2009
Member
Hello, Martin.
Some description:
xsdtest - Ecore model
in xsdtest.test project:
customs.ru.categories._3._0._0.tests._0Example - main class
test.QuickStart - class which provides SessionFactory
test.xml - input xml


  • Attachment: w2.rar
    (Size: 462.35KB, Downloaded 105 times)
Re: [Teneo+hibernate] [message #605219 is a reply to message #81796] Fri, 04 May 2007 06:23 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020906080109030003060303
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I checked and there are several types which use the same eattribute name for a many eattribute. This
results in one jointable called goodsDescription (which stores the values of the eattribute) which
is created/used for all these occurences. This is a missing feature of Teneo. Teneo should choose a
unique join table name (for one-to-many ereferences this is done, but not yet for many eattributes).
Can you enter a bugzilla for this?
This will be solved in the next release (which will be in a few weeks).

In the mean time you can set the join table name through annotations. This has to be done for each
occurence of the eattribute with a name-clash (and which has many=true). I attached an example xml
to do that for one for one eclass. This xml should be put in the source tree (classpath) and the
classpath location (incl. filename) should be passed to teneo using the
PersistenceOptions.PERSISTENCE_XML option. What you will see is that a jointable with name
'myuniquename' is created.

I checked and there are at least two other eattribute names which are being used by multiple
eclasses for a many-eattribute:
AutoMotoParametersType
ProcessingGoodsDeclarationType

but maybe there are more.

gr. Martin

wolf_roma wrote:
> Hello, Martin.
> Some description:
> xsdtest - Ecore model
> in xsdtest.test project:
> customs.ru.categories._3._0._0.tests._0Example - main class
> test.QuickStart - class which provides SessionFactory
> test.xml - input xml
>
>


--

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

--------------020906080109030003060303
Content-Type: text/xml;
name="test.persistence.xml"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="test.persistence.xml"

<?xml version="1.0" encoding="utf-8"?>
<persistence-mapping xmlns="http://www.eclipse.org/emft/teneo"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<epackage
namespace-uri="urn:customs.ru:ESADCommonAggregateTypes:3.0.1 ">
<eclass name="GoodsItemBaseType">
<property name="goodsDescription">
<join-table name="myuniquename"/>
</property>
</eclass>
</epackage>

</persistence-mapping>
--------------020906080109030003060303--
Re: [Teneo+hibernate] [message #605222 is a reply to message #81845] Fri, 04 May 2007 07:33 Go to previous message
Roman Bliznets is currently offline Roman BliznetsFriend
Messages: 75
Registered: July 2009
Member
Thanks. I will be use PersistenceOptions.PERSISTENCE_XML before release next
Teneo version.
I see what you already create issue in bugzilla (183563), it dosn't?
Re: [Teneo+hibernate] [message #605226 is a reply to message #81860] Fri, 04 May 2007 07:52 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi, no this is a different issue (although related) can you create a new bugzilla?
Can you also include a hyperlink to the newsgroup discussion then that would help others who see the
issue?
Thanks.

gr. Martin

wolf_roma wrote:
> Thanks. I will be use PersistenceOptions.PERSISTENCE_XML before release next
> Teneo version.
> I see what you already create issue in bugzilla (183563), it dosn't?
>
>
>


--

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+hibernate] [message #605323 is a reply to message #81875] Mon, 07 May 2007 07:11 Go to previous message
Roman Bliznets is currently offline Roman BliznetsFriend
Messages: 75
Registered: July 2009
Member
I create issue 185717
https://bugs.eclipse.org/bugs/show_bug.cgi?id=185717
If I did mistake then sorry.
Previous Topic:Using "external" library in JET template
Next Topic:[teneo-jpox] jdoDatastore initialize failed on with mulitple ecores
Goto Forum:
  


Current Time: Fri Apr 19 04:56:43 GMT 2024

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

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

Back to the top