That is ok* Declare the dob field as:

@Temporal(TemporalType.Date)
private (java.util.)Date dob;
*

But why not this in wicket 1.4.
I am pasting my code
*Book.java
##########
        import java.sql.Date;
        ...
        private Date publishDate;


META-INF/persistence.xml
########################
<persistence xmlns="http://java.sun.com/xml/ns/persistence"; version="1.0">
 <persistence-unit name="bookStorePersistence">
   <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
   <class>edu.shubit.eShop.bean.Book</class>
   <properties>
        <property name="eclipselink.platform.class.name"
value="org.eclipse.persistence.platform.database.SQLAnywherePlatform"/>
                <property name="eclipselink.jdbc.driver" 
value="org.sqlite.JDBC"/>
        <property name="eclipselink.jdbc.url"
value="jdbc:sqlite:data/bookStoreDB"/>
        <property name="persistence.tools.weaving" value="false"/>
        <property name="eclipselink.ddl-generation" value="create-tables"/>
        <property name="eclipselink.ddl-generation.output-mode"
value="database"/>
   </properties>  
 </persistence-unit>
</persistence>


BookUploadPage.java
###################
        Book book=new Book();
        ...
        frm=new Form("bookUploadForm",new CompoundPropertyModel(book)){
                {
                        add(txtDate=new TextField("publishDate"));
                }
                protected void onSubmit(){
                        BeansManager.insertBook(book)){                         
                }
        }
        

BeansManager.java
#################
        public static boolean insertBook(Book book) {
                JPA.em.getTransaction().begin();
                JPA.em.persist(book);
                JPA.em.getTransaction().commit();
                return true;
        }
        

*


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/java-util-Date-cannot-be-cast-to-java-sql-Date-tp4484703p4485118.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to