Xyna-Factory / xyna-factory

Sources of the Xyna Factory Server, Xyna runtime applications (like GuiHttp or gitintegration), and installation scripts.
Apache License 2.0
16 stars 3 forks source link

Storables: Issues with usage of base.KeyValue #391

Open Maikel-Shinoda opened 1 year ago

Maikel-Shinoda commented 1 year ago

When trying to use the complex datatype base.KeyValue in a Storable (or in an XMOM which is used as a member of a Storable), you cannot deploy the datatype which has base.KeyValue as a member. The error message looks like the following:

java.lang.RuntimeException: com.gip.xyna.xnwh.exceptions.XNWH_GeneralPersistenceLayerException: Error within Factory Warehouse: Could not add table "data6", storable "base.KeyValue_data6_1288_Storable" to persistencelayers ... Caused by: com.gip.xyna.xnwh.exception.SQLRuntimeException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VARCHAR(128) NULL, typename VARCHAR(1024) NULL,

corneliuslippert-gip commented 1 year ago

i'm pretty sure this is caused by us not having support for recognizing words reserved by the database (like "key" or "type", etc). or alternatively support for proper escaping of the words when creating the DDL commands in the persistencelayers.

LLdaniel commented 1 month ago

Just in order to add problematic datatypes for a future list: This also happens with xact.templates.Document because of the DocumentType member.

Caused by: com.gip.xyna.xnwh.exceptions.XNWH_GeneralPersistenceLayerException: Error within Factory Warehouse: Could not add table "documenttype", storable "xact.templates.CSV_documenttype_926_Storable" to persistencelayers
    at com.gip.xyna.xnwh.persistence.ODSImpl.addTableToPersistenceLayers(ODSImpl.java:2241)
    at com.gip.xyna.xnwh.persistence.ODSImpl.registerStorable(ODSImpl.java:2172)
    at com.gip.xyna.xnwh.persistence.ODSImpl.registerStorable(ODSImpl.java:2130)
    at com.gip.xyna.xnwh.persistence.xmom.XMOMPersistenceManagement$StructureCacheRegistrator.finish(XMOMPersistenceManagement.java:640)
    ... 24 more
[...]
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'separator VARCHAR(128) NULL,
  ADD COLUMN maskalways BOOLEAN NULL' at line 8
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    at com.mysql.jdbc.Util.getInstance(Util.java:386)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2415)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2333)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2318)
    at com.gip.xyna.utils.db.SQLUtils.executeDDL(SQLUtils.java:674)