[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2161) hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect, sqltype = char, NUL but not NULL.

Shutra (JIRA) noreply at atlassian.com
Fri Oct 20 03:51:04 EDT 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2161?page=comments#action_24910 ] 

Shutra commented on HHH-2161:
-----------------------------

I'm sorry.
The sql that hibernate generated is right.
Maybe it is a bug of  postgresql's jdbc driver: org.postgresql.Driver while saving '\0'.
Thanks, please close this bug.
_________________
    <dependency>
      <groupId>postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>8.1-407.jdbc3</version>
    </dependency>

		User user = new User();
		user.setGender('M');
		Transaction t = HibernateTest.getSessionFactory().getCurrentSession()
				.beginTransaction();
		HibernateTest.getSessionFactory().getCurrentSession().save(user);
		t.commit(); //Saved OK.

		user = new User();
		user.setGender('\1');
		t = HibernateTest.getSessionFactory().getCurrentSession().beginTransaction();
		HibernateTest.getSessionFactory().getCurrentSession().save(user);
		t.commit(); // Also saved OK.

		user = new User();
		user.setGender('\0');
		t = HibernateTest.getSessionFactory().getCurrentSession().beginTransaction();
		HibernateTest.getSessionFactory().getCurrentSession().save(user);
		t.commit(); // Failed. That means the '\0' is not supported by the jdbc of postgresql.

2006-10-20 15:44:23,638 DEBUG [org.hibernate.impl.SessionImpl] - opened session at timestamp: 11613302636
2006-10-20 15:44:23,638 DEBUG [org.hibernate.transaction.JDBCTransaction] - begin
2006-10-20 15:44:23,638 DEBUG [org.hibernate.jdbc.ConnectionManager] - opening JDBC connection
2006-10-20 15:44:23,638 DEBUG [org.hibernate.transaction.JDBCTransaction] - current autocommit status: false
2006-10-20 15:44:23,638 DEBUG [org.hibernate.event.def.AbstractSaveEventListener] - generated identifier: 2c90c1710e64ad81010e64ad86560003, using strategy: org.hibernate.id.UUIDHexGenerator
2006-10-20 15:44:23,653 DEBUG [org.hibernate.transaction.JDBCTransaction] - commit
2006-10-20 15:44:23,653 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] - processing flush-time cascades
2006-10-20 15:44:23,653 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] - dirty checking collections
2006-10-20 15:44:23,653 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] - Flushed: 1 insertions, 0 updates, 0 deletions to 1 objects
2006-10-20 15:44:23,653 DEBUG [org.hibernate.event.def.AbstractFlushingEventListener] - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
2006-10-20 15:44:23,653 DEBUG [org.hibernate.pretty.Printer] - listing entities:
2006-10-20 15:44:23,653 DEBUG [org.hibernate.pretty.Printer] - test.hibernate.User{id=2c90c1710e64ad81010e64ad86560003, username=null, gender=


> hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect, sqltype = char, NUL but not NULL.
> ----------------------------------------------------------------------------------------------
>
>          Key: HHH-2161
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2161
>      Project: Hibernate3
>         Type: Bug

>  Environment: hibernate-3.2.0.cr5.jar, postgresql 8.1.x
>     Reporter: Shutra

>
>
> When insert, if  the sql type is char and the value is null, then the generated sql is like this:
> insert  into table (column) values(?),
> then the postgresql said: 
> insert into table(column) values(NUL)
> but not insert into table(column) value(NULL).
> Important: the sql type is character(in mapping file) and the java type is char.

-- 
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