facebook

[Closed] Reverse engineer to BigDecimal

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

    Hello,

    I have tried to make this particular column be reverse engineered as BigDecimal and can’t figure out what is needed to make it work. Here is the table defintion:

    
    create table items(
    ItemNumber varchar(6) PRIMARY KEY not null,
    Description varchar(28),
    GenericCode varchar(6),
    GenericName varchar(28),
    GenericRating char(2),
    AWP decimal(30,2),
    UnitOfIssue char(2),
    PackageSize char(5),
    Color char(5),
    Dosage char(3),
    ChangeDate date,
    ScheduleCode char(2),
    Manufacturer varchar(10),
    UPC varchar(11),
    NDC varchar(11))
    

    The AWP column should be a BigDecimal, not double. On page 3 of the RE wizard I have tried filling in the JDBC type using java.math.BigDecimal and unqualified BigDecimal. I have left the Hibernate type blank and used BigDecimalType, qualified and unqualified.

    The relevant part of my mapping file:

    
            <property name="awp" type="java.lang.Double">
                <column name="AWP" precision="30" />
            </property>
    

    What do you have to do to make a column be reverse engineered as BigDecimal?

    My sig says ME 4.1 but I’m on 4.11.

    #248941 Reply

    Brian Fernandes
    Moderator

    On page 3 of the RE wizard I have tried filling in the JDBC type using java.math.BigDecimal and unqualified BigDecimal. I have left the Hibernate type blank and used BigDecimalType, qualified and unqualified.

    Use the qualified name in the Hibernate type field, and delete it from the JDBC type field.

    Best,
    Brian.

    #248963 Reply

    Thanks! I’ll give it a shot.

    Randy

    #248989 Reply

    Still java.lang.Double type.

    #248990 Reply

    Brian Fernandes
    Moderator

    Randy,

    I tried this out and it works just fine for me. A few questions:

    1) Have you blanked out the JDBC type and Property name fields for that column entirely? When you re-invoke RE, do you see “java.math.BigDecimal” in the Hibernate type field for the AWP column or do you have to retype it every time? If you have to type it in each time, that means the settings aren’t getting saved.

    2) Have you made any special settings on page 2?

    3) Any errors in the log after generation? Try deleting (or check the timestamps) on the generated .hbm.xml file to make sure you aren’t seeing a stale file.
    The error log is especially important – you can clear the log before generation so that you get a list of the errors logged only during generation.

    Best,
    Brian.

    #248995 Reply

    Thanks for the super fast response! I don’t think I could ask for a quicker response.

    The key was the log file. The DTD in hibernate.reveng.xml was pointing to http://www.hibernate.sourceforge.net instead of hibernate.sourceforge.net so evidently dom4j was throwing exceptions when it tried to parse the file. I just renamed the file and let ME regenerate it and now it’s java.math.Double.

    Thanks again,
    Randy

    #248996 Reply

    Brian Fernandes
    Moderator

    Randy,

    Thank you for the compliment!
    I’m glad it is working for you now 🙂

    Best,
    Brian.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: [Closed] Reverse engineer to BigDecimal

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