---
title: "hibernate text"
author: "ttitfly"
date: "2007-10-22T17:40:35Z"
tags: ["Hibernate", "MySQL"]
categories: ["非技术"]
slug: "hibernate-text"
draft: false
lastmod: "2007-10-22T17:40:35Z"
id: 134503
url: "https://ttitfly.iteye.com/blog/134503"
---

mysql数据库的一个表里的字段logins是text类型的。 hibernate对改字段的映射为： \[code] \[/code] 实体类： \[code]public class User{ private String logins; }\[/code] 程序里取出该实体对象 \[code]User user = (User)getHibernateTemplate().load(entityClass, id) System.out.println(user.getLogins());\[/code] \[color=red]打印出的值是类似这样的byte类型的 \[B@35acf6\[/color] hibernate好像自动把数据库里取出来的值给转换成了byte类型的了。 有没有办法使得user.getLogins()出来的直接是String的（也就是数据库里是什么，取出来的就是什么）