Re: Queryentities - inserts with the Enum fields - failing with cachestore turned on
Hi, When i specify as: Then I got the error when converting the inputs to Enum: 2019-01-23T17:38:48,340 ERROR o.a.i.i.p.o.j.JdbcRequestHandler [client-connector-#79] Failed to execute SQL query [reqId=0, req=JdbcQueryExecuteRequest [schemaName=PUBLIC, pageSize=1024, maxRows=0, sqlQry=INSERT INTO GEN.Entitlements (NAME, TYPE) VALUES ('ent1','FUNCTION'), args=[], stmtType=ANY_STATEMENT_TYPE]] org.apache.ignite.internal.processors.query.IgniteSQLException: Value conversion failed [from=java.lang.String, to=com.myproject.model.EntitlementType] Caused by: org.h2.message.DbException: Hexadecimal string contains non-hex character: "FUNCTION" [90004-195] Unless there is another way to enforce the conversion in some more direct way? Regards Michal -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Queryentities - inserts with the Enum fields - failing with cachestore turned on
Hi, I have a problem with very simple class being exposed to SQL with Enum field and want to use it togheter with custom CacheStore class managing the writeBehind to SQLServer database. My class is: public class Entitlement { Type type; String name; (...) } Where type is an Enum: public enum Type { FUNCTION, INDEX } And I am exposing this through the Queryentities configuration where the enum is exposed as String: name The selects work, then I am running the following insert from SQL client (DBeaver): INSERT INTO gen.ENTITLEMENTS(NAME, TYPE) VALUES ('PROF12', 'FUNCTION1'); The cache has the native persistence turned off. The insert succeeds when there is no 3rd party persistence turned on. Even the following query succeeds with no cachestore (where FUNCTION1 is not in enum values): INSERT INTO gen.ENTITLEMENTS(NAME, TYPE) VALUES ('PROF12', 'FUNCTION1'); However when I switch on the third party persistence than the insert will fail complaining about the field being Enum not String. 2019-01-23T09:24:48,588 ERROR o.a.i.i.p.o.j.JdbcRequestHandler [client-connector-#43] Failed to execute SQL query [reqId=0, req=JdbcQueryExecuteRequest [schemaName=PUBLIC, pageSize=1024, maxRows=0, sqlQry=INSERT INTO GEN.Entitlements (NAME, TYPE) VALUES ('ent1','FUNCTION'), args=[], stmtType=ANY_STATEMENT_TYPE]] org.apache.ignite.internal.processors.query.IgniteSQLException: Failed to execute DML statement [stmt=INSERT INTO GEN.Entitlements (NAME, TYPE) VALUES ('ent1','FUNCTION'), params=null] Caused by: org.apache.ignite.binary.BinaryObjectException: Failed to deserialize object [typeName=com.myproject.model.Entitlement] Caused by: org.apache.ignite.binary.BinaryObjectException: Failed to read field [name=type] Caused by: org.apache.ignite.binary.BinaryObjectException: Unexpected field type [pos=24, expected=Enum, actual=String] How can this be solved that the inserts using Enums are being fine by the CacheStore class and written to SQL DB? If i have the class witn no Enums - the inserts are working just fine and data are persisted in 3rd party SQLServer DB with my custom cachestore class' write methods. Thanks Michal -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Queryentities - inserts with the Enum fields - failing with cachestore turned on
Hi, I have a problem with very simple class being exposed to SQL with Enum field and want to use it togheter with custom CacheStore class managing the writeBehind to SQLServer database. My class is: public class Entitlement { Type type; String name; (...) } Where type is an Enum: public enum Type { FUNCTION, INDEX } And I am exposing this through the Queryentities configuration where the enum is exposed as String: name The selects work, then I am running the following insert from SQL client (DBeaver): INSERT INTO gen.ENTITLEMENTS(NAME, TYPE) VALUES ('PROF12', 'FUNCTION1'); The cache has the native persistence turned off. The insert succeeds when there is no 3rd party persistence turned on. Even the following query succeeds with no cachestore (where FUNCTION1 is not in enum values): INSERT INTO gen.ENTITLEMENTS(NAME, TYPE) VALUES ('PROF12', 'FUNCTION1'); However when I switch on the third party persistence than the insert will fail complaining about the field being Enum not String. 2019-01-23T09:24:48,588 ERROR o.a.i.i.p.o.j.JdbcRequestHandler [client-connector-#43] Failed to execute SQL query [reqId=0, req=JdbcQueryExecuteRequest [schemaName=PUBLIC, pageSize=1024, maxRows=0, sqlQry=INSERT INTO GEN.Entitlements (NAME, TYPE) VALUES ('ent1','FUNCTION'), args=[], stmtType=ANY_STATEMENT_TYPE]] org.apache.ignite.internal.processors.query.IgniteSQLException: Failed to execute DML statement [stmt=INSERT INTO GEN.Entitlements (NAME, TYPE) VALUES ('ent1','FUNCTION'), params=null] Caused by: org.apache.ignite.binary.BinaryObjectException: Failed to deserialize object [typeName=com.myproject.model.Entitlement] Caused by: org.apache.ignite.binary.BinaryObjectException: Failed to read field [name=type] Caused by: org.apache.ignite.binary.BinaryObjectException: Unexpected field type [pos=24, expected=Enum, actual=String] How can this be solved that the inserts using Enums are being fine by the CacheStore class and written to SQL DB? If i have the class witn no Enums - the inserts are working just fine and data are persisted in 3rd party SQLServer DB with my custom cachestore class' write methods. Thanks Michal -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: Native persistence and 3rd party persistence on one cluster?
Hi, thanks for the advice. I have configured to regions and they are having their own independent persistence settings. Thanks Michal -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Native persistence and 3rd party persistence on one cluster?
Hi, Can we have 2 sets of caches configured - with 1 set of caches having the native persistence in files and the second set with disabled native persistence with only 3rd party persistence in SQL (using custom CacheStore classes implementation)? If yes - how can this be achieved in ignite-node-cfg.xml configuration? Regards Michal -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: Ignite Plugin development ...
Hi, in this examples you have either WhiteListNullPlugin or WhiteListAuthenticator @Override public IgnitePlugin plugin() { System.out.println("new plugin"); return new WhiteListNullPlugin(); } @Override public IgnitePlugin plugin() { return new WhiteListAuthenticator(); } Could you provide example implementation of this WhiteListHullPlugin / WhiteListAuthenticator class? Thanks Michal -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: Reading from the SQLServer persistence store with write-behind setting
Hi Ilya, I do have all the mappings configured for all my caches and they are written successfully to SQLServer database using the writeBehind setting. My question is - will these mapping automatically be used when I want to use the readThrough functionality or do I have to specify some additional mappings or implementation of any other classes? Can you give some examples of using the loadCache, loadAll, getAll? Regards Michal -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: Reading from the SQLServer persistence store with write-behind setting
Hi, do I have to write any method lor cache.loadCache or it should be used as is? Is using loadCache an alternative to using the readThrough? I tried to use both options and can't see any attempt during starting my cache to even try loading the data from my SQL Server database. ReadThrough doesn't seem to work at all. Though the write-behind works absolutely fine. Unless I am missing any extra configuration. I expected that it will use my XML cache mappings. My setup is below: (...) My Java code for starting cache: private static IgniteCache myCache = null; public void start() throws StorageException { Ignite ignite = myCacheFactory.start(); if (myCache == null) { synchronized(lock) { if (myCache == null) { myCache = ignite.getOrCreateCache("myCache"); myCache.loadCache(null); } } } How to trigger Ignite to actually try loading the data from the store (CacheJdbcPojoStoreFactory using SQL Server JDBC driver). Thanks Michal -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Reading from the SQLServer persistence store with write-behind setting
Hi, I have the persistence store setup to use the write-behind setting and it works pretty smoothly. I wanted to ask how we can use this persistence store as the source of data - actually read from the database when starting the Ignite cluster. Could you please provide some usecases to test the Ignite failure scenario so that the data are restored from the SQLServer database. I have some doubts how it works as some Ignite data are converted to strings (datetime) and no idea how Ignite would process it. Thank you Michal -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: Instant data type mapping to SQLServer through Pojo store
Hi, I have a Class with Instant data type: private Instant indexCreated; Then I map it to VARCHAR in PojoStore: And then I am getting the error from SQLServer JDBC driver: 2018-09-03T11:48:36,737 ERROR o.a.i.i.p.c.s.GridCacheWriteBehindStore [flusher-0-#46] Unable to update underlying store: CacheJdbcPojoStore [] javax.cache.CacheException: Failed to set statement parameter name: indexCreated at org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore.fillParameter(CacheAbstractJdbcStore.java:1391) ~[ignite-core-2.6.0.jar:2.6.0] at org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore.fillValueParameters(CacheAbstractJdbcStore.java:1443) ~[ignite-core-2.6.0.jar:2.6.0] at org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore.writeAll(CacheAbstractJdbcStore.java:1102) ~[ignite-core-2.6.0.jar:2.6.0] at org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore.updateStore(GridCacheWriteBehindStore.java:816) [ignite-core-2.6.0.jar:2.6.0] at org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore.applyBatch(GridCacheWriteBehindStore.java:726) [ignite-core-2.6.0.jar:2.6.0] at org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore.access$2400(GridCacheWriteBehindStore.java:76) [ignite-core-2.6.0.jar:2.6.0] at org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$Flusher.flushCacheCoalescing(GridCacheWriteBehindStore.java:1147) [ignite-core-2.6.0.jar:2.6.0] at org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$Flusher.body(GridCacheWriteBehindStore.java:1018) [ignite-core-2.6.0.jar:2.6.0] at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110) [ignite-core-2.6.0.jar:2.6.0] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_112] Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The conversion from UNKNOWN to UNKNOWN is unsupported. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:228) ~[mssql-jdbc-6.4.0.jre8.jar:?] at com.microsoft.sqlserver.jdbc.DataTypes.throwConversionError(DataTypes.java:1647) ~[mssql-jdbc-6.4.0.jre8.jar:?] at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(SQLServerPreparedStatement.java:1868) ~[mssql-jdbc-6.4.0.jre8.jar:?] at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObjectNoType(SQLServerPreparedStatement.java:1695) ~[mssql-jdbc-6.4.0.jre8.jar:?] at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setObject(SQLServerPreparedStatement.java:1704) ~[mssql-jdbc-6.4.0.jre8.jar:?] at org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore.fillParameter(CacheAbstractJdbcStore.java:1385) ~[ignite-core-2.6.0.jar:2.6.0] ... 9 more -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Instant data type mapping to SQLServer through Pojo store
Hi, I have a Instant data types in my Ignite data model and I want to map it to SQL Server. I don't have a problem with Date or Time types, but I can't map the Instant one. Is there any way to still map it (even to VARCHAR) or if it is not on the supported data types (https://apacheignite-sql.readme.io/docs/data-types) then I will not be able to map it through CacheJdbcPojoStoreFactory? Regards Michal -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: apache ignite cassandra persistentStore for enum fields
Ilya, Thank you for all clarifications! Best regards Michal -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: apache ignite cassandra persistentStore for enum fields
Hi Ilya, Thank you for your advice. It does work now when I put my class as the javaFieldType. However one thing still does bother me. Previously you advised that Ignite will determine itself if the enum is ORDINAL or a STRING and store accordingly - either Ordinal or the Name. So I have accordingly mapped 2 fields - one as Integer and one as String. Here is my SQLServer Table: CREATE TABLE [dbo].[CCache1]( [ric] [varchar](255) NOT NULL, [state] [int] null, [type] [varchar](255) null ) The problem is that no matter if I map the ENUM to Integer or String - it always stores it as Integer, even in Varchar column. Please advise. Please see the SQLServer results after storing data in Ignite: select top 100 ric, state, type from [CCache1] ric state type .CSUS0457 1 20 Thanks, Michal -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: apache ignite cassandra persistentStore for enum fields
Hi Ilya, Following up to ENUMs - what should I put then as the JavaFieldType? I tried java.lang.Enum, java.lang.Integer and it is failing. What value should be specified for PojoStore to correctly map the Enum to DatabaseFieldName and Type? Thank You, Michal -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: apache ignite cassandra persistentStore for enum fields
Hi, I have the same issue with CacheJdbcPojoStore with writeBehind persistency in SQL DB. Is it only possible to store ENUMs as BLOBs or is there any other way to map them as strings, or anything else? I got the ENUMs both in the Key and Value fields. Regards Michal -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: Ignite with POJO persistency in SQLServer
Thanks for this, this clarifies a lot. Could you only advise which data type should be used and how to map the field of type which is my class? Should I use BINARY or this cannot be handled at all? My intuition is that I should map the my.package.ListingCode to the java.sql.Types.JAVA_OBJECT. However if it is not supported the only other binary object would be byte[] - but this also returned an error. Can you advise any solution? Thank you Michal -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: Ignite with POJO persistency in SQLServer
Hi All, I tried mapping the fields in number of different combinations based on the above, but all the time I am failing with the SQLServerException: The conversion from UNKNOWN to UNKNOWN is unsupported. The mappings I used in the following structure included: I also checked other combinations of: javaFieldTypes: my.package.ListingCode byte[] java.lang.Byte[] java.sql.Blob Object to JdbcTypes (java.sql.Types.): LONGVARBINARY VARBINARY Based on the SQLServer JDBC driver documentation and Ignite's all this should be supported. Could you please shed some more live how the object is passed to the driver and how best it should be mapped in XML? Thank you -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: Ignite with POJO persistency in SQLServer
Thank you for the help! -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: Ignite with POJO persistency in SQLServer
Andrei, As I understand you - the only way to map embedded classes is by using mapping them as objects and store as BLOBs or other VARBINARY fields in SQL database? No way to decompose them into separate fields in the tables? Eg. ListingCode has: private String code; private String codeType; Please confirm if the BLOB is only way or there is any way to get the embedded object's fields and store them in separate columns. I understand same goes for the array - only store it in BLOB or redesign the domain object model, right? Thank you Michal -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: Ignite with POJO persistency in SQLServer
Hi Anrei, My goal is to map the data using CacheJdbcPojoStore and save the data that I already have in Ignite to SQLServer. The data model has embedded classes and I don't know how to map them. Currently I got the following setup, which works fine, but that is only the subset of data. Is it possible to map the firstType (class ListingCode) and the listings (which is the collection of Listing object)? Thanks, Michal -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Ignite with POJO persistency in SQLServer
Hi, I have my Ignite that has complex objects classes with not only generic Java data types, but also other classes and arrays of classes. I managed to setup my PojoStore that successfully writes (write-behind) data to SQL Server table for all generic data types. I see no examples or guidelines, how to map the embedded objects to separate SQL Server tables (or the same SQL Server table). Please advise. My EquityClass has the following fields: Long equityID; private ListingCode firstCode; private String equityName; private String equityType; private String equityClass; private Set listings; And I have problem mapping the firstCode and the listings - array of Listing objects. Is it possible? If yes, could you share any examples of mapping such embedded objects into SQL DBs? Regards, Michal -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/