how to solve "java.sql.Timestamp does not have a no-arg default constructor" ?
2012-10-19 15:55
686 查看
Step 1, create TimestampAdapter class
Step 2, Attach the following code to every usage of the Timestamp class,such as:
import java.sql.Timestamp; import java.util.Date; import javax.xml.bind.annotation.adapters.XmlAdapter; public class TimestampAdapter extends XmlAdapter<Date, Timestamp> { public Date marshal(Timestamp v) { return new Date(v.getTime()); } public Timestamp unmarshal(Date v) { return new Timestamp( v.getTime()); } }
Step 2, Attach the following code to every usage of the Timestamp class,such as:
@XmlJavaTypeAdapter(value=TimestampAdapter.class,type=Timestamp.class) @Column(name = "ENDTIME", length = 7) public Timestamp getEndtime() { return this.endtime; } public void setEndtime(Timestamp endtime) { this.endtime = endtime; }
相关文章推荐
- how to solve "java.sql.Timestamp does not have a no-arg default constructor" ? .
- java.sql.timestamp does not have a no-arg default constructor
- Resolving: java.sql.Timestamp does not have a no-arg default constructor
- 如何解决sql server2005的“不允许远程连接”错误.(how to resolve the error: "SQL Server does not allow remote connections" for SQL Server2005)
- java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- The declared package "" does not match the expected package "javaControlSql"
- java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- how to solve "linux scp command not found"
- How to solve "java.lang.VerifyError: Expecting a stackmap frame at branch target 6 in method"
- java.sql.SQLException: Userdoes not have access to metadata required to determine stored procedurepa
- Unable to locate the server named "localhost" --- the server does not have a DNS entry. Perhaps ther
- java数据库连接(mysql)java.sql.SQLExcept "Host 'Lenovo-PC' is not allowed to connect to this MySQL server"
- How to solve "one or more projects in the solution were not loaded correctly" problem?
- How to solve "\Java\jdk1.7.0_45' was unexpected at this time." while starting jboss-eap-6.2
- How to solve 'object of abstract class type "newFoo" is not allowed'?
- java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- java.sql.SQLException: null, message from server: "Host '192.168.1.101' is not allowed to connect
- java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- How to solve "The installation source for this product is not available" problem?
- mac安装jello,安装不过去,报gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/