开发者

Spring Roo Oracle and Underscore

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开发者_C百科 to avoid the underscore. I suppose naming my column personname would fix this, but can I ask spring not to add the underscore ?


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 by default refers to the JPA implementation to determine column names. You can override the defaults with the --column property:

entity --class Foo
field string --fieldName FooBar --column fooBar


Bonjour, by the way, I do not think that it is possible to reverse engineer a database with underscores in table names :

  1. the corresponding domain classes will be created and compiled since Java accept undersocres in class names
  2. the tests will be performed without raising any issue
  3. everything will be scaffold for the GUI
  4. you will succesfully deploy it on tomcat and your application page will show up in your browser
  5. You may fill the form to create a new instance of your object
  6. But if you click on SAVE --> internal error

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 ...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜