facebook

Trouble reverse engineering Postgres database tables

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

    LenGrant
    Member

    I’m attempting to reverse engineer a large amount of tables using the Hibernate Reverse Engineering process, but every time I do, the fields that are boolean in my database are converted to Byte types in the classes that are generated.

    Is there a way to prevent this from happening?

    #287008 Reply

    Loyal Water
    Member

    On the second page of the Hibernate Reverse Engineering wizard, you can specify the custom mapping. There you will have to map the boolean to Byte type there.

    #288066 Reply

    mschirmer
    Member

    we have the same problem with our postgre database and the hibernate reverse engineering tool. booleans in the database are converted to byte and bytea[] (binary data) is converted to string by the tools.

    Can you give me a detailed description on how to define customized mappings on page 2 of the wizard?

    thanks

    #288343 Reply

    Loyal Water
    Member

    On the second page, there is a Customized Type Mappings table. First, you need to click the Add button. Next, click on the JDBC Type cell and enter the JDBC type (VARCHAR, CHAR etc) that you want to map. Click on thHibernate type and enter the Java type that the JDBC type should match to.

    Hit Finish and that should take care of the rest.

    Here is a table that you can refer to go get an idea on what Java Types the JDBC types should map to.
    http://db.apache.org/ojb/docu/guides/jdbc-types.html

    #289687 Reply

    kbowen42
    Member

    The specific mapping that works to make postgress BOOLEAN map into java boolean is to map JDBC BIT to java boolean on p.2 of the JPA mapping wizard.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Trouble reverse engineering Postgres database tables

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