Re: java.util.Date cannot be cast to java.sql.Date

2012-03-23 Thread Alok Pathak
Kindly Help

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/java-util-Date-cannot-be-cast-to-java-sql-Date-tp4484703p4498860.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



java.util.Date cannot be cast to java.sql.Date

2012-03-19 Thread Alok Pathak
I have an application in Wicket 1.4, where i am using JPA. I declared an
entity (Customer) with property *dob* of type *java.sql.Date*. 
Now i want to migrate that application in Wicket 1.5, When I submit the
registration form of the customer I get the exception: *java.util.Date
cannot be cast to java.sql.Date*
Kindly Help
Thanks 
Alok Pathak


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/java-util-Date-cannot-be-cast-to-java-sql-Date-tp4484703p4484703.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



Re: java.util.Date cannot be cast to java.sql.Date

2012-03-19 Thread Martin Grigorov
Hi,

Do you say that in 1.4 you didn't do any conversion between the two
types and it just worked ?
See Component#getConverter(Class) method.

On Mon, Mar 19, 2012 at 3:02 PM, Alok Pathak alokpatha...@gmail.com wrote:
 I have an application in Wicket 1.4, where i am using JPA. I declared an
 entity (Customer) with property *dob* of type *java.sql.Date*.
 Now i want to migrate that application in Wicket 1.5, When I submit the
 registration form of the customer I get the exception: *java.util.Date
 cannot be cast to java.sql.Date*
 Kindly Help
 Thanks
 Alok Pathak


 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/java-util-Date-cannot-be-cast-to-java-sql-Date-tp4484703p4484703.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




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: java.util.Date cannot be cast to java.sql.Date

2012-03-19 Thread Bas Gooren

Declare the dob field as:

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

Op 19-3-2012 14:02, schreef Alok Pathak:

I have an application in Wicket 1.4, where i am using JPA. I declared an
entity (Customer) with property *dob* of type *java.sql.Date*.
Now i want to migrate that application in Wicket 1.5, When I submit the
registration form of the customer I get the exception: *java.util.Date
cannot be cast to java.sql.Date*
Kindly Help
Thanks
Alok Pathak


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/java-util-Date-cannot-be-cast-to-java-sql-Date-tp4484703p4484703.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



Re: java.util.Date cannot be cast to java.sql.Date

2012-03-19 Thread Alok Pathak
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
   providerorg.eclipse.persistence.jpa.PersistenceProvider/provider
   classedu.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