-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate Eclipse Console - passing parameters to the driver
PostPosted: Wed May 31, 2006 5:23 pm 
Newbie

Joined: Mon May 08, 2006 5:25 pm
Posts: 3
I am trying to use the Hibernate Console for Eclipse to model queries against a MySql 5.0 database that has timestamp fields that defaults to 0000-00-00 00:00:00. I am encounter errors since some of the default fields can't be represented as java.sql.Timestamp (see console error below).

Apparently, I need to add the mysql configuration of zeroDateTimeBehavior=convertToNull to the driver

http://forums.mysql.com/read.php?39,815 ... #msg-89052

how can I do this with the Eclipse Hibernate console?


Hibernate version:

3.1.3

Mapping documents:

<class name="com.ambientdevices.wine.hibernate.Billing" table="Billing">
<cache usage="read-write" />
<id name="billingId" type="java.lang.String">
<generator class="assigned" />
</id>
<property name="createDate"/>
<property name="modifiedDate"/>
<property name="deviceId"/>
<property name="nextBillDate"/>
<property name="weatherCity"/>
<property name="paySchedule"/>
<property name="billFullName"/>
<property name="billAddress1"/>
<property name="billAddress2"/>
<property name="billCity"/>
<property name="billState"/>
<property name="billZipcode"/>
<property name="billPhone"/>
<property name="mailBillsame"/>
<property name="mailFullName"/>
<property name="mailAddress1"/>
<property name="mailAddress2"/>
<property name="mailCity"/>
<property name="mailState"/>
<property name="mailZipcode"/>
<property name="mailPhone"/>
<property name="ccNumber"/>
<property name="ccExpMonth"/>
<property name="ccExpYear"/>
<property name="ccType"/>
<property name="lastAttemptDate"/> <!--This field is problematic at it is 0000-00-00 00:00:00 -->
</class>


Full stack trace of any exception that occurs:

Warning 2006-05-31 16:53:14.234 WARN main org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: S1009
Error 2006-05-31 16:53:14.234 ERROR main org.hibernate.util.JDBCExceptionReporter - Value '0000-00-00' can not be represented as java.sql.Timestamp

Name and version of the database you are using:

MySql 5.0

_________________
Software Engineer
Ambient Devices


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 5:47 pm 
Newbie

Joined: Mon May 08, 2006 5:25 pm
Posts: 3
I was able to figure this out. I needed to add the configuration to the connection url of the hibernate.cfg file.

<property name="hibernate.connection.url">jdbc:mysql://localhost/lportal?zeroDateTimeBehavior=convertToNull</property>

_________________
Software Engineer
Ambient Devices


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.