0

When I try to use the stereotype DISCUSSION with Oracle I get an error because of the entity DiscussionComment column named "comment". Although I'm using the correct dialect for my Oracle version, Hibernate is not quoting DDL as needed. This is a very common problem with simple solution. I just want to apply the solution to OpenXava.

I tried to change the DiscussionComment source in OpenXava project (the one that comes with the OpenXava IDE). I changed the column name but it had no effect.

What and where should I change to alter the mapping of the entity?

The same problem applies to "YourFirstEntity", the demo entity of every project because of the "date" column.

Gustavo
  • 1,332
  • 2
  • 16
  • 39
  • 1
    In order the change in OpenXava code has effect you have to follow this instructions: https://openxava.org/OpenXavaDoc/docs/modify-openxava-code_en.html – javierpaniza Oct 26 '21 at 11:57
  • The problem is on schema generation or when the application is running? – javierpaniza Oct 26 '21 at 11:58
  • On schema generation. The "create table..." fails. – Gustavo Oct 26 '21 at 12:12
  • Did you execute schema generation from Ant, or is configured in persistence.xml so it's executed on applicaiton startup? could I see the stacktrace? – javierpaniza Oct 28 '21 at 12:21
  • Configured in persistence.xml, executed on application startup. The output in console says the statement "create table..." failed. I just copied the output SQL to an Oracle tool and it failed too. When I changed the name of the column to "commentary" it worked. – Gustavo Oct 28 '21 at 14:35
  • Try to add the property hibernate.globally_quoted_identifiers to true in your persistence unit in persistence.xml. If it works we could add it as a official answer here. We got the tipo from here: https://stackoverflow.com/questions/2224503/how-to-map-an-entity-field-whose-name-is-a-reserved-word-in-jpa – javierpaniza Nov 02 '21 at 13:25
  • `hibernate.globally_quoted_identifiers=true` actually worked. No need to make changes in the OpenXava folder and recompile. – Gustavo Aug 19 '22 at 19:36

2 Answers2

0

To modify OpenXava Java code, XML or i18n files:

  • Modify the code on OpenXava/src, OpenXava/xava or OpenXava/i18n.

  • Execute the Ant target buildOpenXava from OpenXava/build.xml. It compiles the OpenXava Java code and creates openxava.jar.

  • Refresh OpenXava project in Eclipse (F5).

  • Execute the Ant target updateOX from the build.xml of your own project.

  • Refresh your own project in Eclipse (F5).

reference: https://openxava.org/OpenXavaDoc/docs/modify-openxava-code_en.html

Credits to @javierpaniza

Gustavo
  • 1,332
  • 2
  • 16
  • 39
0

Add the property hibernate.globally_quoted_identifiers to true in your persistence unit in persistence.xml

javierpaniza
  • 677
  • 4
  • 10