程序运行时自动生成的:
Hibernate:
select
this_.id as id0_0_,
this_.add_time as add2_0_0_,
this_.buyer_id as buyer3_0_0_,
this_.code as code0_0_,
this_.name as name0_0_,
this_.oid as oid0_0_,
this_.position as position0_0_,
this_.seller_id as seller8_0_0_,
this_.sign_time as sign9_0_0_,
this_.status as status0_0_
from
ts_contract this_
但是数据库里的字段是:sellerId ,signTime ; 程序运行错误:
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'this_.add_time' in 'field list'
Hibernate:
select
this_.id as id0_0_,
this_.add_time as add2_0_0_,
this_.buyer_id as buyer3_0_0_,
this_.code as code0_0_,
this_.name as name0_0_,
this_.oid as oid0_0_,
this_.position as position0_0_,
this_.seller_id as seller8_0_0_,
this_.sign_time as sign9_0_0_,
this_.status as status0_0_
from
ts_contract this_
但是数据库里的字段是:sellerId ,signTime ; 程序运行错误:
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'this_.add_time' in 'field list'
当数据字段为一个单词时如:name,age 映射正常
但是当由两个单词组成时如:myAge,myName 就会自动变成my_age,my_name
请问这是什么原因?
问题的根源是:
当数据字段为一个单词时如:name,age 映射正常
但是当由两个单词组成时如:myAge,myName 就会自动变成my_age,my_name
请问这是什么原因?
你说的"自动"不太理解, 你是在MySQL中编写表结构时出现这个问题吗? 还是在编写JavaBean的时候? 或者在写映射文件的时候?