Reputation: 73
We are doing inserts of a few millions records in 1 time in a Cassandra 3.0 database. Question is : what has best performance: using the mapper (annotating our object 'JPA' style) or using a prepared statement, which will only be prepared once and then bind for every insert. I read here that the mapper does an implicit prepared statement in the background so performance should not differ. But I don't understand where he should keep that prepared statement? Or is it done for every insert, which would take away the advantage of doing a prepared statement. So question : mapper (jpa style) or preparedStatement (JDBC style :-) ) ?
Upvotes: 3
Views: 578
Reputation: 87234
Mapper keeps prepared statements in the instance of Mapper
class, and instances of the Mapper
class are kept in the MappingManager
, so if you're recreating MappingManager
all the time, then you're loosing you're prepared statements, and get the worse performance...
If you go with prepared statements directly, then you need to keep it somewhere together with instance of Session
object that you should create only once & reuse.
Upvotes: 1