facebook

Hibernate Reverse Engineering

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

    dmailhot
    Member

    Hi,

    I have seen quite a few postings regarding Hibernte Reverse Engineering but none on this exact issue. We are doing reverse eng. from a Oracle 9i db. On the page 2, whatever customized type mappings I put are being ignored. but it works if I do it on page 3 for each and every column… not acceptable given the number of tables.. Any ideas? Can you also tell me where the logs go for the reverse-engineering. Strangely enough, I don’t see any.

    Thanks

    #259279 Reply

    Brian Fernandes
    Moderator

    Hi,

    Can you give me an example of the types you are entering on page 2? It is possible that you are entering Oracle specific data types while that page only accepts standard JDBC types – we are looking at improving this in the future. If you the type names with JDBC names, it should work.

    There is no separate log for Hibernate Reverse Engineering; errors, if any, are logged to the standard eclipse Error Log. You can find further instructions on logging and other questions that would help track your problem here: Posting Guidelines

    A final question – do you have entires on page 2 of the RE wizard and page 3 at the same time? I ask because usually when you have an invalid entry on page 2, all the settings are skipped, including those on page 3. Your log should tell us all we need to know.

    Best,
    Brian.

    #259300 Reply

    dmailhot
    Member

    Hi,

    yes, I am actually mapping JDBC types and not Oracle. For instance I enter TIMESTAMP in the JDBC type and in the hibernate type I enter timestamp. Another example is JDBC= NUMERIC and hibernate type= big_decimal. I apologize for not copying and pasting the actual reverse-eng.xml file. It is because our dev. environment is on a different network without any access to the web (gov. security sector). And I have tried probably a dozen other examples..all ignored.

    For the log, if it is the same eclipse log well, there are no errors as the log file is empty. As for the page 3, yep, I can have entries in both and the entries on the page 2 are ignored… Even though I am login as the schema owner, could that be that some of the catalogs are not accessible..seems unlikely. Any other ideas? Any switch that can be turned on that would give me debug level logs?

    Thank you

    #259336 Reply

    Brian Fernandes
    Moderator

    Your setting should work, lets try the following:

    1) On page 2, what is your Type Mapping settting (the radio buttons on top of the page)? Can you try switch that to “Hibernate Types” and see if it works?

    2) Remove your customization on page 3 for one particular column. Can you tell me it’s exact data type (e.g. Number(5, 3)) and the corresponding mapping you are trying with on page2? I’ll see if that works here of it is incorrect – this should put us on the same page.

    3) We don’t have a debug switch for our logs, errors are logged at all times. I’m surprised your log is completely empty so if you go to Window > Show Views > Other > PDE Runtime > Error Log – the view that comes up is empty?

    Best,
    Brian.

    #259657 Reply

    dmailhot
    Member

    Brian,

    Sorry, I was on vacation for a few days. First, the reason why I was not seeing anything in the error log is that well, I was not looking at that one. There is another one on the Eclipse folder. Didn’t realize there was a view for the PDE Runtime Error log. Soo, I tried what you just suggested.

    – Table DataTypes: In that table I have a bunch of Oracle NUMBER with different sizes: 9, 22, 5, 12. All of which with decimal set to 0. The TIMESTAMP attribute is size 11, decimal 6. Database is Oracle 9i.
    – Page 2 – Type is set to Hibernate Types
    – Page 2 – The mapping entries I have entered are: JDBC: NUMERIC – Hibernate: string and JDBC: TIMESTAMP – Hibernate: timestamp
    – Page 2- Just to be safe, the rev-eng file is a new one.
    – Page 3- Left unchanged.
    – I execute… All NUMBER attributes map to long and TIMESTAMP to String. Which is the exact output I get if I don’t specify any mappings. I looked at the error logs and nothing is generated. Btw, just to be sure, I changed NUMERIC to ERWQRW and got an error entry so it is logging in the case of an error. So it seems like there are no errors entry generated in the setup described above.

    The rev-eng xml file look perfectly fine with only the 2 mappings I described above. Nothing else.

    Thank you.

    #259660 Reply

    Brian Fernandes
    Moderator

    I appreciate your detailed response to all my queries.

    1) For the NUMBER, on page 2, instead of NUMERIC, use DECIMAL. I realize this is not very intuitive and we are looking into this for our next release.

    2) For the TIMESTAMP column, specifying a JDBC type TIMESTAMP on page 2 worked just fine for me. Could you confirm the size and precision of your TIMESTAMP column?
    Can you try specifying TIME and DATE in addition to TIMESTAMP? Also on page 2, is the “Generate version and timestamp tags” checkbox selected?

    Hope this helps, do let us know how it goes,
    Brian.

    #259696 Reply

    dmailhot
    Member

    Brian..

    Alright. It works. Here is what I did and I need some explanations as well

    Steps:
    1) I changed NUMERIC to DECIMAL and it picked up the NUMBER data type and did the conversion I wanted.
    2) Now both my mappings are being picked up and all is fine…Thanks

    Question:
    I don’t get it.
    1) What does that checkbox “Generate version and timestamp tags” does?
    2) It is really strange. “Generate version and timestamp tags” was checked all along. I unckecked it just prior to my that test and it all worked fine (with DECIMAL). I changed it back to NUMERIC and checked it again and it still work for timestamp (wasn’t before). It seems like something was stuck or defaulted somewhere and now that I have unchecked that box once it all works. Very strange. Now that it is working I cannot replicate the wrong behavior on my instance. Don’t bother, it seems to be just one of those things…

    Anyway, it works now. Would you mind posting or emailing a list of the JDBC to Hibernate mapping for Oracle if you have such a thing? NUMERIC seemed like the right one (still does) and I would like to avoid other cases like that later.

    Thanks for your support. It was really helpful, thorough and responsive support.

    #259770 Reply

    Brian Fernandes
    Moderator

    1) What does that checkbox “Generate version and timestamp tags” does?

    This generates version and timestamp tags instead of the corresponding properties if your column is named VERSION or TIMESTAMP. This checkbox is usually off by default, in any case it should not have affected the page 2 settings, I’ll check again and see if I can reproduce the odd behaviour you experienced.

    DECIMAL vs NUMERIC
    There is a very subtle difference between these SQL types, and perhaps the Oracle NUMBER type maps more closely to DECIMAL as compared to NUMERIC. What we will try to do to improve this is allow you to specify your database specific type so as to avoid this confusion in the future; we want you to be able to specify NUMBER directly on page 2 and that should be picked up.

    Thanks for your support. It was really helpful, thorough and responsive support.

    Thanks for the compliment, we appreciate it 🙂

    Brian.

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Hibernate Reverse Engineering

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