ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kenan Dalley <kenan.dal...@gm.com>
Subject Ignite to Cassandra change from 1.9 to 2.0
Date Tue, 23 May 2017 17:41:41 GMT
I've just upgraded to the new version 2.0 from 1.8/1.9 with a Cassandra .xml
configuration as the backing data-store.  However, v2.0 is failing to pull
the column name that's tied to the field name in the persistence definition. 
Because of that, the CQL being generated is trying to call Cassandra using
the field name (e.g. sessionId) instead of the column name (e.g.
session_id).  I'm including my persistence.xml configurations that I've
tried: one using a pure POJO strategy definition and one using a POJO
strategy with the definition spelled out in the config file.  Neither
worked.

Error
[13:20:54,721][SEVERE][main][CassandraCacheStore] Failed to execute
Cassandra CQL statement: insert into "dev_keyspace"."HistoryResult"
("algorithmname", "sessionid", "key", "analysistime", "createdby",
"createddate", "modifiedby", "modifieddate", "results", "sessiontime")
values (?,?,?,?,?,?,?,?,?,?) using ttl 2592000;
class org.apache.ignite.IgniteException: Failed to execute Cassandra CQL
statement: insert into "dev_keyspace"."HistoryResult" ("algorithmname",
"sessionid", "key", "analysistime", "createdby", "createddate",
"modifiedby", "modifieddate", "results", "sessiontime") values
(?,?,?,?,?,?,?,?,?,?) using ttl 2592000;


Pure POJO Strategy Config
<persistence keyspace="dev_qlty" table="HistoryResult" ttl="2592000">
	<tableOptions>
		comment = 'Test table for Ignite/Cassandra connection'
		AND read_repair_chance = 0.2
	</tableOptions>

	<keyPersistence class="com.gm.model.HistoryResultKey" strategy="POJO" />

	<valuePersistence class="com.gm.model.HistoryResult" strategy="POJO" />
</persistence>


POJO Strategy Full Definition Config
<persistence keyspace="dev_qlty" table="HistoryResult" ttl="2592000">
	<tableOptions>
		comment = 'Test table for Ignite/Cassandra connection'
		AND read_repair_chance = 0.2
	</tableOptions>

	<keyPersistence class="com.gm.model.HistoryResultKey" strategy="POJO">
	    <partitionKey>
	        <field name="key"/>
	    </partitionKey>
	    <clusterKey>
	        <field name="sessionId" column="session_id"/>
	        <field name="algorithmName" column="algorithm_name"/>
	    </clusterKey>
	</keyPersistence>
	<valuePersistence class="com.gm.model.HistoryResult" strategy="POJO">
        <field name="key"/>
        <field name="sessionId" column="session_id"/>
	    <field name="sessionTime" column="session_time"/>
        <field name="algorithmName" column="algorithm_name"/>
        <field name="results"/>
	    <field name="analysisTime" column="analysis_time"/>
        <field name="createdDate" column="created_dt"/>
        <field name="createdBy" column="created_by"/>
        <field name="modifiedDate" column="modified_dt"/>
	    <field name="modifiedBy" column="modified_by"/>
	</valuePersistence>
</persistence>


HistoryResultKey
public class HistoryResultKey {
	private String key;
	private String sessionId;
	private String algorithmName;

	public HistoryResultKey() {
		// No op.
	}

	public HistoryResultKey(final String key, final String sessionId, final
String algorithmName) {
		this.key = key;
		this.sessionId = sessionId;
		this.algorithmName = algorithmName;
	}

	@AffinityKeyMapped
	@QuerySqlField(index = true, groups = { "historyResultPK" })
	public String getKey() {
		return this.key;
	}

	@QuerySqlField(index = true, groups = { "historyResultPK" }, name =
"session_id")
	public String getSessionId() {
		return this.sessionId;
	}

	@QuerySqlField(index = true, groups = { "historyResultPK" }, name =
"algorithm_name")
	public String getAlgorithmName() {
		return this.algorithmName;
	}
}


HistoryResult
public class HistoryResult {
	private String key;
	private String sessionId;
	private Date sessionTime;
	private String algorithmName;
	private String results;
	private Date analysisTime;
	private Date createdDate;
	private String createdBy;
	private Date modifiedDate;
	private String modifiedBy;

	public MatlabHistoryResult() {
		// no op
	}

	public MatlabHistoryResult(final String key, final String sessionId, final
Date sessionTime,
			final String algorithmName, final String results, final Date
analysisTime, final Date createdDate,
			final String createdBy, final Date modifiedDate, final String modifiedBy)
{
		this.key = key;
		this.sessionId = sessionId;
		this.sessionTime = sessionTime;
		this.algorithmName = algorithmName;
		this.results = results;
		this.analysisTime = analysisTime;
		this.createdDate = createdDate;
		this.createdBy = createdBy;
		this.modifiedDate = modifiedDate;
		this.modifiedBy = modifiedBy;
	}

	@QuerySqlField
	public String getKey() {
		return this.key;
	}

	@QuerySqlField(name = "session_id")
	public String getSessionId() {
		return this.sessionId;
	}

	@QuerySqlField(name = "session_time")
	public Date getSessionTime() {
		return this.sessionTime;
	}

	@QuerySqlField(name = "algorithm_name")
	public String getAlgorithmName() {
		return this.algorithmName;
	}

	@QueryTextField
	public String getResults() {
		return this.results;
	}

	@QuerySqlField(name = "analysis_time")
	public Date getAnalysisTime() {
		return this.analysisTime;
	}

	@QuerySqlField(name = "created_dt")
	public Date getCreatedDate() {
		return this.createdDate;
	}

	@QuerySqlField(name = "created_by")
	public String getCreatedBy() {
		return this.createdBy;
	}

	@QuerySqlField(name = "modified_dt")
	public Date getModifiedDate() {
		return this.modifiedDate;
	}

	@QuerySqlField(name = "modified_by")
	public String getModifiedBy() {
		return this.modifiedBy;
	}
}



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Ignite-to-Cassandra-change-from-1-9-to-2-0-tp13099.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Mime
View raw message