2

Is there any way to perform bulk insert into a DB table using Apache Cayenne. There are some scenarios for me where I need to perform bulk insert. I am not sure how can we do this in Cayenne.

Any help in this regard is really appreciated.

Bhavik Ambani
  • 6,357
  • 14
  • 52
  • 84
Narendra
  • 5,195
  • 9
  • 34
  • 54

1 Answers1

1

There are two ways - EJBQLQuery and SQLTemplate. EJBQLQuery can be used if you can express your query in therms of the object model. E.g.:

UPDATE Publisher pub SET pub.status = 'outstanding' WHERE pub.revenue < 1000000

Otherwise use SQLTemplate. It even allows batching of multiple parameter sets (see 'setParameters').

andrus_a
  • 2,418
  • 1
  • 14
  • 10