Set Cassandra host(s), port and keyspace at runtime?

12 views
Skip to first unread message

hbf

unread,
Aug 14, 2015, 12:05:13 AM8/14/15
to kundera-discuss
Hey everybody,

I am in a situation where I'm don't know the Cassandra host(s), port, and my application's keyspace at compile time. I therefore cannot put it into the persistence.xml file.

Is there a way to set this at runtime?

Thanks for any ideas or pointers!
Huck

Chhavi Gangwal

unread,
Aug 14, 2015, 5:11:55 AM8/14/15
to kundera-discuss
Hi

Take a look at the following test case in which you can set the persistence properties by setting an external map  . You can populate this map at runtime while connection creation (EntityManagerFactory)

https://github.com/impetus-opensource/Kundera/blob/4ab46233e39b87c5516e0f870dd581b79eaac265/src/kundera-cassandra/cassandra-core/src/test/java/com/impetus/client/cassandra/config/CassandraPropertySetterTest.java

Hope this Helps
Chhavi
Reply all
Reply to author
Forward
0 new messages