Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with datatype in DTO  RSS feed

 
Rajeshwar Tripathi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i am new in java.

For my project i use mysql as database & IceFaces as jsf implementation .

here the problem is i need to submit date of birth to database.
so i took java.util.Calendar as datatype but its giving error even though i converted it in java.sql.Date

so can any one tell me what datatype of DOB should i take in my DTO & how to use it.

help is appreciable .

thanks
rajeshwar .
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm afraid we need more information. You didn't tell us what the actual error was.

DTOs aren't used much any more. With EJB3/JPA, the actual model object can be accessed without the intermediary DTO that earlier EJB implementations required. For raw JDBC, what you have isn't so much a J2EE DTO as it is a model object that doesn't have an ORM to support it (so you have to do all the work yourself).

If you are using an ORM, we need to know if it's Hibernate, JPA, EJB or one of the other alternatives. The brand of database isn't that important when using an ORM.

At the JDBC level, the preferred datatype for dates is usually java.sql.Date, although depending on the driver, java.util.Date, java.lang.String and even some of the number data types may be accepted. That's assuming that the target table in the database is defined to use Date-type objects to hold date values. Otherwise, the target datatype determines the rules.
 
Rajeshwar Tripathi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks to reply Tim,

can you tell me what data type should be used in the model for DOB?

thanks
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rajeshwar Tripathi wrote:thanks to reply Tim,

can you tell me what data type should be used in the model for DOB?

thanks


Not without information on the actual database code.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!