Hi, I installed AppFuse2 Spring MVC modular and I've been adding my own classes to the Hibernate model package. I am using MySQL5 Everything was fine until and introduced a Date element on the DB model. The structure on the database is always created correctly(datetime type on MySQL) but when I am trying to autopopulate data from an XML file by running mvn command from the root project I get the error below:
I have tried java.util.Date, java.sql.Date and java.util.Calendar but no luck so far On the default-data.xml file this is what i have: <table name="tbl_events"> <column>event_id</column> <column>event_name</column> <column>description</column> <column>start_date</column> <column>end_date</column> <column>address</column> <column>province</column> <column>city</column> <column>country</column> <column>postal_code</column> <column>total_distance_km</column> <column>type_id</column> <row> <value description="event_id">1</value> <value description="event_name">Event name1 example</value> <value description="description">Event description1 example</value> <value description="address">123 main st</value> <value description="city">New York</value> <value description="country">US</value> <value description="start_date">2008-09-11 10:45:40</value> <value description="end_date">2008-09-11 10:45:40</value> <value description="total_distance_km">10</value> <value description="postal_code">10014</value> <value description="province">NY</value> <value description="type_id">1</value> </row> . . . I have tried multiple variations of date formats but nothing seems to work and I have reached a dead end. Also, I have been searching for similar answer on this forum with no luck so far My Class: @Entity @Table(name="tbl_events") @NamedQueries ({ @NamedQuery( name = "findAllEventsWithName", query = "select re from RunningEvent re where re.eventName like :eventName " ) }) public class RunningEvent extends BaseObject implements Serializable { private static final long serialVersionUID = 3832626162173359422L; private Long eventId; private String eventName; private String description; private Date startDate; //I have tried java.util.Date, java.sql.Date and java.util.Calendar but does not work . . . @Column(name="start_date",nullable=true) public Date getStartDate() { return startDate; } . . . public void setStartDate(Date startDate) { this.startDate = null; /*Below are examples of stuff i have tried*/ //this.startDate = Calendar.getInstance(); //this.startDate.set(2008, 10, 10); //this.startDate=Calendar.getInstance().getTime(); } Embedded error: Error casting value for table 'tbl_events' and column 'start_date' [INFO] ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.lifecycle.LifecycleExecutionException: Error executing database operation: CLEAN_INSERT at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:564) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125) at org.apache.maven.cli.MavenCli.main(MavenCli.java:280) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) Caused by: org.apache.maven.plugin.MojoExecutionException: Error executing database operation: CLEAN_INSERT at org.codehaus.mojo.dbunit.OperationMojo.execute(OperationMojo.java:110) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539) Any help will be highly appreciated thanks oscar -- View this message in context: http://www.nabble.com/Date-typecast-exception-tp19314832s2369p19314832.html Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]