facebook

[Closed] Using "Hibernate reverse Engineering" to

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #281738 Reply

    sharonxchen
    Member

    I am new to Hibernate and myEclipse, I am trying to using “Hibernate reverse engineering” to generate code, however, both Blob and Raw type become String type? How can I generate Java DAO with the right type?

    e.g.
    CREATE TABLE TESTME
    (
    ID INTEGER NOT NULL,
    DESCRIPTION BLOB

    )

    generated mapping file is:

    <class name=”com.ssa.wex.dao.Testme” table=”TESTME” schema=”WEX”>
    <id name=”id” type=”java.lang.Long”>
    <column name=”ID” precision=”22″ scale=”0″ />
    <generator class=”increment” />
    </id>
    <property name=”description” type=”java.lang.String”>
    <column name=”DESCRIPTION” />
    </property>
    </class>

    The description has been handled as “String” not “Blob”, what I should do?

    #281768 Reply

    Loyal Water
    Member

    sharonxchen,
    On the second page of the Hibernate Reverse engineering wizard there is a custom mapping option. You can use that to custom map your Blob field.

    #281772 Reply

    sharonxchen
    Member

    I got an error when doing the followings:

    On the second page, I have put JDBC type as “BLOB” and Hibernate type as “java.sql.Blob”.
    after click Finish, I got an error, the error in the log file is:

    org.hibernate.MappingException: Could not configure overrides from file: C:\sandbox\wex\hibernate.reveng.xml
    at org.hibernate.cfg.reveng.OverrideRepository.addFile(OverrideRepository.java:106)

    Caused by: org.hibernate.MappingException: jdbc-type: Integer is not a known JDBC Type nor a valid number

    It seems did not like type “BLOB”, I am using Oracle 9.

    Thanks!

    #281819 Reply

    sharonxchen
    Member

    Hi, Nipun,

    can you give me suggestions? Still does not work.

    #281830 Reply

    Brian Fernandes
    Moderator

    Sharon,

    It looks like you might have a stale setting in your hibernate.reveng.xml file which is somehow not being reported in the wizard. Can you please delete the file before invoking the wizard and then add the entry again? (the file will be created automatically). Alternatively you can use the wizard to specify a new reveng.xml file and make your change.

    It would also help if you clear the error log before invoking the wizard. This makes it easier to analyze the problem.

    Please let us know how it turns out. If it does not work, please paste your reveng.xml here.

    #282050 Reply

    sharonxchen
    Member

    it worked, thanks!!

    #282062 Reply

    Loyal Water
    Member

    Glad it worked.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: [Closed] Using "Hibernate reverse Engineering" to

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