Spring Roo Oracle 和 Underscore
我有一个关于 spring roo 和数据库的问题。 我有一个名为 personName 的字段,在 oracle 中将列创建为 person_Name
我有一种方法可以避免使用下划线。我想命名我的列 personname 可以解决这个问题,但是我可以要求 spring 不要添加下划线吗?
I have a question concerning spring roo and databases.
I have a field called personName, in oracle to column is create as person_Name
I there a way to avoid the underscore. I suppose naming my column personname would fix this, but can I ask spring not to add the underscore ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您需要通用解决方案(而不是“修复”某些单点(abaloghs 答案)),您可以为 JPA 提供程序指定命名策略。
有关示例,请参阅:JPA (Hibernate) 和自定义表前缀
If you need a general solution (instead of "fixing" some single points (abaloghs answer)), you can specify a Naming Strategy for your JPA provider.
For an example see: JPA (Hibernate) and custom table prefixes
Roo 默认情况下引用 JPA 实现来确定列名称。您可以使用 --column 属性覆盖默认值:
Roo by default refers to the JPA implementation to determine column names. You can override the defaults with the --column property:
你好,
顺便说一句,我不认为可以对表名中带有下划线的数据库进行逆向工程:
如果您查看 tomcat 日志,您会发现众所周知的异常: javax.servlet.jsp.JspTagException: No message found under code ...
原因是您的类名已在 message_xx 中被截断。属性文件。
下划线之前的所有内容都被删除,因此找不到任何消息来显示您的记录已成功保存。
如果 ROO shell 在创建 jpa 实体时而不是在运行时抛出错误,那就太好了……
Bonjour,
by the way, I do not think that it is possible to reverse engineer a database with underscores in table names :
If you have a look at the tomcat log, you will fid the well known exception : javax.servlet.jsp.JspTagException: No message found under code ...
The reason is that your class name has been truncated in the message_xx.properties files.
Everything before the underscore is dropped and thus, no message is found in order to display that your record has been successfully saved.
It would be nice that the ROO shell raise an error when the jpa entity is created and not at runtime ...