[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3251) EJB query UPDATE with java.sql.Timestamp

Ralf Alt (JIRA) noreply at atlassian.com
Thu Apr 24 10:52:33 EDT 2008


EJB query UPDATE with java.sql.Timestamp
----------------------------------------

                 Key: HHH-3251
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3251
             Project: Hibernate3
          Issue Type: Bug
          Components: core
    Affects Versions: 3.3.0.CR1
         Environment: MS SQL 2005, java version "1.6.0_05", Sun Java System Application Server 9.1_01 (build b09d-fcs)
Hibernate 3.3.2.GA

            Reporter: Ralf Alt
            Priority: Critical


Entity bean with Timestamp field.

    @Version
    @Column(name="modtime",nullable=false,insertable=false,updatable=true)
    protected Timestamp getModificationtimeTS() {
            return myModTime;
    }
    protected void setModificationtimeTS(Timestamp timestamp) {
            myModTime = timestamp;
    }

EJBQuery: "UPDATE ADRESS.class.getName() set name = :_name, modificationtimeTS = :_modtime where id = :_id"

Query qry = entityMgr.createQuery( query )
                                    .setParameter( "_name", "Newer" )
                                    .setParameter( "_modtime", new Timestamp( System.currentTimeMillis() ))
                                    .setParameter( "_id", 1 );

The generated SQL 
declare @p1 int
set @p1=NULL
exec sp_prepexec @p1 output,N'@P0 nvarchar(4000), at P1 datetime',N'update ADRESS set name=@P0, modtime=@P1 where id=@P2',N'Newer',''2008-04-24 16:14:17:490'',1
select @p1

The error is in the time stampformat for the sql server (syntax error in the near of '2008').
                   

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list