facebook

Default length of Date type column in generated hbm.xml file

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #288402 Reply

    anumola
    Member

    We’ve been using MyEclipse IDE for generating Hiberanate in our project. The generated hibernate mapping files have the length set as ‘7’ for the Date type columns in the xml file. We’ve deployed our application in production and seems to be working fine.

    I would expect the Date field to be of length 10 if it is of ‘MM/DD/YYYY’ format or 19 if it is of ‘MM/DD/YYYY hh:mm:ss’ format. I couldn’t think of any reason how number ‘7’ can be related to a Date field. I’d think if MyEclipse is putting that value in the generated file and that there is some reason behind it. While it is assuring to know the reason behind chosing that value, most importantly I would like to know if there are any issues that are reported related to this subject. Any thoughts?

    #288461 Reply

    Riyad Kalla
    Member

    anumola,

    Unfortunately I don’t know why Hibernate gens that value as length 7… it’s has done this for a while from what I can see, so I don’t think there is anything wrong.

    You could test it easily enough I suppose by trying to enter a date of say 12/25/2008 and see if it goofs.

    #288468 Reply

    anumola
    Member

    Thanks for the reply Riyad.

    As I said in my original post, in our application Date fields are working fine with MM/DD/YYYY format. I’m only concerned that the length of 7 on the Date column have other limitations that we’ve not encountered yet.

    So, are you saying that it is not MyEclipse that is generating the value ‘7’ in the length for the Date type columns? Instead it is Hibernate that does it?

    #288495 Reply

    Riyad Kalla
    Member

    So, are you saying that it is not MyEclipse that is generating the value ‘7’ in the length for the Date type columns? Instead it is Hibernate that does it?

    I believe we make use of some of the Hibernate libraries to do the field analysis when rev-eng, so I think this is one of those “If that’s the way Hibernate sees it, then it must be right” things… also considering it’s been doing it for a while and so far so good.

    Sorry I don’t have a highly technical response to that, I just don’t know.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Default length of Date type column in generated hbm.xml file

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