Dec 10th, 2012, 08:15 AM
spring jdbc newbie- how to correctly use/convert between date formats in a java API
I am working to create an API using Spring. Now, I wish to use Spring JDBC to create this API in Java.
The API will also have to store/retrieve date values in SQL Server database.
What I would like to know is
(1) Do I store/retrieve the date as java.sql.date? I mean, I want to use jdbctemplate, and in that, do I define the class member corresp. to the date, as java.sql.date? or do I define it as java.util.date?
(2) The API will be accessed by programs in languages other than Java, for eg Flex (ie Flash)--> since this is different from Java, do I convert the data in the Java API to a string, and send it as a string as output? (That s what I think it should be)... Also, in this case, do I store the variable itself as a string variable (the variable in class corresp. to that table in which data is stored) or java.sql.date or java.util.date?
Please pardon me if my questions sound silly, I am very new to Spring JDBC, hence the above questions
Tags for this Thread