Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Hibernate 3.1.1
Mapping documents:
Using annotations beta-8. Excerpt:
Code:
@Column(unique = true, nullable = false)
public String getUsername()
@Lob
public String getSignature();
Code between sessionFactory.openSession() and session.close():Code:
User user = new User();
user.setUsername(System.currentTimeMillis() + " åäö");
user.setSignature(user.getUsername());
session.persist(user);
Name and version of the database you are using:MySQL 5.0.18 (InnoDB)
The generated SQL (show_sql=true):Code:
insert
into
User
(username, email, messagesPerPage, name, signature)
values
(?, ?, ?, ?, ?)
Debug level Hibernate log excerpt:Code:
2006-01-25 15:28:27,921 DEBUG Printer:90 - com.company.User{contacts=null, signature=1138199307453 åäö, messagesPerPage=10, username=1138199307453 åäö, email=1138199307453 åäö, name=null, id=2}
Ok, so the username and signature should be identical, "1138199307453 åäö". However, the @Lob property (signature) only shows as "1138199307453 " in the db, "åäö" is omitted.
Judging from the sql server log, the only real difference I can see between an insert from phpmyadmin and one from hibernate is SET NAMES "latin1" vs "utf8". Do I need to tell Hibernate to use utf8 for the connection? "åäö" are latin1 characters, I don't understand.
--Martin