facebook

Export through Hiberate creates wrong property type

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #211184 Reply

    oertig
    Member

    Hi,

    If I try to generate the Hibernate mapping file with the wizard “Export trough Hibernate…” a wrong proprty type is generated.

    The field in the database is defined as Integer or Int(10).

    This field will be generated as java.lang.String if “Key Field Type” in the wizard is set to Java-Types, or as serialiazable it it is set to Hibernate-Types.

    <property name=”mftUc” column=”MFT_UC” type=”java.lang.String” length=”10″ not-null=”true”/>
    <property name=”mftUc” column=”MFT_UC” type=”serializable” length=”10″ not-null=”true”/>

    The java attributes resulting from this mapping file will be of the type java.lang.String or java.io.Serializable.

    What did I wrong? What can I do that the wizard will correctly will generate a field of Type long or Long?

    I’M using Eclipse 3.0 and MyEclipse Build 200407091200-3.8-Beta2

    Thanks for the help.

    Werner

    #211296

    Riyad Kalla
    Member

    Werner,
    I’ve asked our Hibernate dev to look at this.

    #211348

    support-jeff
    Member

    Werner –

    You actually have to specify the id type in the wizard (combo select under the java vs hibernate type radio buttons) – this is a limitation/bug in the plugin on which the MyEclipse DB Explorer is based.

    If you wait for 3.8 GA, you will no longer have to performa that useless task – the plugin figures it out for you (even composite ids) 😉

    #214558

    tarantula
    Participant

    Hi Jeff,

    I’m using 3.8.1 and having problems translating primary key types when exporting tables through Hibernate. I’m using MySQL (4.0) and my keys are BigInt (20) unsigned. The resulting Java property is always java.lang.String. I’ve seen this come up in another post and the solution was to manually update both the mapping files and your Java classes. Can you tell me if there is a template I can change somewhere that will use java.lang.Integer for ID properties instead?

    -Thank you

    #214562

    support-jeff
    Member

    The templates pretty much cover syntax/format, not the logic. This seems to be an issue for MySQL. The basic logic is: get table metadata, for each column get java.sql.Type, perform relatively simple mapping (so I suspect that the SQL types getting returned are off for some reason).

    #214569

    tarantula
    Participant

    I’ve read elsewhere that there is a problem displaying MySQL foreign keys is the Database Explorer perspective (please see http://www.myeclipseide.com/PNphpBB2+file-viewtopic-t-2881.html ). Are these two issues related? Does the Hibernate mapping generator depend on the database explorer somehow? Is it a MySQL driver issue? It would be great if you found the bug that is causing this database metadata to disappear.

    #214654

    support-jeff
    Member

    tarantula –

    Are these still an issue for you, or does the newly release Connector/J release (3.0.15-prod) fix them for you. The release appears to address a large number of db metadata related issues.

    #214657

    tarantula
    Participant

    Amazing. The Hibernate plugin works perfectly for me now. Thanks for the tip!

    I still have an issue with the Table Info view of the DB Explorer. Foreign keys are still not being listed, although indexes and primary keys are showing up fine. Any suggestions on how to get ME to use the new Connector/J driver, or is something else causing this?

    #214671

    support-jeff
    Member

    It’s a bug. I will probably be addressing this for 3.8.2. If not that release then 3.9 definitely

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: Export through Hiberate creates wrong property type

You must be logged in to post in the forum log in