1
大写的数据库名称,我逆向工程与Spring Roo的样本MySQL数据库和我试图插入一条记录使用Customer实体以这样的方式Spring Roo的+ Hibernate的:在查询
Customer customer = new Customer();
customer.setFirstName("Raffaello");
customer.setLastName("Baresi");
customer.persist();
但是,在初始连接到数据库时插入查询失败,所以我启用了完整的查询日志,并且我注意到模式名称被大写为ROO_CRM而不是roo_crm。
insert into ROO_CRM.CUSTOMER (COMPANY_ID, FIRST_NAME, LAST_NAME)
values (null, 'Raffaello', 'Baresi')
我database.property文件包含小写名称:
database.url=jdbc\:mysql\://localhost/roo_crm?zeroDateTimeBehavior\=convertToNull&characterEncoding\=UTF-8
而产生的客户类有@RooEntity注释的大写模式属性:
@RooJavaBean
@RooToString
@RooEntity(versionField = "", table = "CUSTOMER", schema = "ROO_CRM")
@RooDbManaged(automaticallyDelete = true)
public class Customer {
}
我认为小写模式名称,干净和重建,以增加预防措施,但模式仍然是大写的查询。我也注意到了Spring管理Customer_Roo_Entity具有以下行:
declare @type: Customer: @Table(name = "CUSTOMER", schema = "ROO_CRM");
仍然是用大写的模式,但我不允许编辑该文件。解决这个问题的正确程序是什么?
当我们引用数据库模式时,我不认为这种情况很重要。顺便说一下你使用的数据库是什么?这可能是一些其他问题。 – bhagyas
嗨@bhagyas,我在Linux上使用MySQL,所以对于这个组合来说很重要。我刚找到解决方案...我忘了运行roo shell ...我知道这听起来有点愚蠢的错误,但我正在学习。 – stivlo
没关系,欢呼声和Roo一切顺利! :) – bhagyas