Hello,

all the examples for the Cassandra integration load the persistence settings 
from a resource. Here is one such example:

<bean id="cache2_persistence_settings" 
class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
    <constructor-arg type="org.springframework.core.io.Resource" 
value="classpath:org/apache/ignite/tests/persistence/blob/persistence-settings-3.xml"
 />
</bean>

Is it possible to define the persistence settings inline, ie. in the same file 
as the cache configuration?

I tried the following:

<bean id="fabricCachePersistenceSettings" 
class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
    <persistence keyspace="test_11" table="fabric">
        <keyPersistence class="java.lang.Long" strategy="PRIMITIVE"/>
        <valuePersistence class="com.brocade.poc.icpoc.model.Fabric" 
strategy="POJO">
            <field name="id"/>  <!-- column is not needed when same as name -->
            <field name="name"/>
            <field name="wwn"/>
        </valuePersistence>
    </persistence>
</bean>

But that resulted in the following error:

class org.apache.ignite.IgniteException: Failed to instantiate Spring XML 
application context 
[springUrl=file:/home/ignite/ignite/test-ignite-cassandra/config-server-cassandra.xml,
 err=Line 48 in XML document from URL 
[file:/home/ignite/ignite/test-ignite-cassandra/config-server-cassandra.xml] is 
invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 48; 
columnNumber: 56; cvc-complex-type.2.4.a: Invalid content was found starting 
with element 'persistence'. One of 
'{"http://www.springframework.org/schema/beans":description, 
"http://www.springframework.org/schema/beans":meta, 
"http://www.springframework.org/schema/beans":constructor-arg, 
"http://www.springframework.org/schema/beans":property, 
"http://www.springframework.org/schema/beans":qualifier, 
"http://www.springframework.org/schema/beans":lookup-method, 
"http://www.springframework.org/schema/beans":replaced-method, 
WC[##other:"http://www.springframework.org/schema/beans"]}' is expected.]

I understand that in most cases it makes more sense to use a resource. But for 
some basic ad-hoc testing it would be convenient to define everything in the 
same file.

Roger


Reply via email to