-->
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.  [ 1 post ] 
Author Message
 Post subject: åäö in a @Lob
PostPosted: Wed Jan 25, 2006 11:58 am 
Beginner
Beginner

Joined: Wed Jan 25, 2006 10:18 am
Posts: 28
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


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

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.