Questions tagged [apache-cayenne]

Apache Cayenne is an open source persistence framework, providing object-relational mapping (ORM) and remoting services.

Cayenne seamlessly binds one or more database schemas directly to Java objects, managing

  • atomic commit and rollbacks
  • SQL generation
  • joins
  • sequences

and more. With Cayenne's Remote Object Persistence, those Java objects can even be persisted out to clients via Web Services.

Full details and documentation can be found at http://cayenne.apache.org

132 questions
0
votes
1 answer

getting a fresh data object in Apache Cayenne

I want each action taken on certain tables to be logged. I want logging at column level (not all but some) so if a value has been changed for certain column I would like to log that for eg. Price for product x has been changed by user U (assume…
Hell Boy
  • 899
  • 5
  • 12
  • 22
0
votes
1 answer

Apache Cayenne many-to-many relationship

I'm new with Apache Cayenne. I have only one Entity, called Product. This entity has a many-to-many relationship with itself, that is a product can contain products, and it can be contained by other products. I can't model this relationship with…
Francesco
  • 1,840
  • 19
  • 24
0
votes
1 answer

Primary keys in `ObjEntity`

Primary keys get special treatments in the default ObjEntitys generated in the GUI. They are removed from the properties, and it seems the best way to get them would be via the .getObjectId().getIdSnapshot(), as a Map, and to set…
Vin
  • 559
  • 2
  • 18
0
votes
1 answer

How to `delete from MY_TABLE`?

cayenneContext.deleteObjects(ObjectSelect.query(MyTable.class).select(cayenneContext)); is not very efficient for many objects. Is there anything elegant like ObjectDelete.delete(MyTable.class) that I failed to discover? SQLExec.query("delete from…
Vin
  • 559
  • 2
  • 18
0
votes
1 answer

How to get the table name from a `DataObject`?

A table my_table should have a generated class named MyTable. How do I get the table name, my_table, from Cayenne while having access to MyTable? I'm not looking for snake_case <=> CamelCase that kind of approach. I'm looking for something like…
Vin
  • 559
  • 2
  • 18
0
votes
1 answer

Cayenne 4.1 - Single Runtime with Multiple Datanodes with different URL and credentials

I have 2 different databases being used by one application. In the xml file, I can declare 2 nodes with different URLs and credentials without a problem. Is there a way to do this in the code? Without creating 2 runtimes.
Trying...
  • 127
  • 9
0
votes
1 answer

Apache Cayenne: Mysql's json search functions problem

my code is: String sql = "SELECT data, JSON_EXTRACT(data, '$.symbol') FROM quote;"; List symbols = SQLSelect.scalarQuery(sql, String.class).select(DbConn.context); error is: Caused by: org.apache.cayenne.CayenneRuntimeException: [v.4.2.RC1…
0
votes
1 answer

How do I register a class/object as listener for object life-cycle events after the ServerRuntime has been built?

The Cayenne docs shows how to use ServerRuntimeBuilder to register as a listener for object life-cycle events with something like this: ServerRuntime.builder() .addConfig("cayenne-model.xml") .addModule(binder ->…
0
votes
1 answer

best practice to handle ObjectId while convert cayenne generated class to other layers

usually, java developers convert objects between layers. for example from application domain objects to persistent entities and vice versa. however, apache cayenne use ObjectId to represent keys in database, and it's a combination of entity name and…
0
votes
1 answer

Apache Cayenne not invalidating objects

After updating to Apache Cayenne version 4.1 (from 4.0) objects don't get invalidated and reloaded as they did before. For example, if I open my application on two browser windows and modify something in one window, the other window doesn't get…
moejoe
  • 138
  • 5
0
votes
1 answer

Apache Cayenne: java.io.StreamCorruptedException

I'm trying to make a simple select query but receive this error: java.io.StreamCorruptedException: invalid stream header: 78780A1F at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:857) In datamap I have a db-attribute of type…
0
votes
0 answers

Apache Cayenne ResultIterator and prefetch joint

We are using Cayenne with something like ResultIterator lvSomeMainList = ObjectSelect .query(Anlstamm.class) .and(SomeMain.ORGUNIT_NR.eq(pvOrgUnitNr)) …
0
votes
1 answer

Apache Cayenne insert data from a non cayenne app to database

I've an Tomcat app running with cayenne, now I habe another application that inserts/changes data from outside in the db! As cayenne is fully cached, what would be the best way to make cayenne aware of the new / changed rows? regards Markus
Meex
  • 45
  • 3
0
votes
1 answer

Apache Cayenne defaultCatalog set by environment var

I want to use a Apache Cayenne Java Web Application in a Docker container, as there are multiple instances running I would like to customize them by environment variables. Now I have the problem that I'm using one central database, with different…
Meex
  • 45
  • 3
0
votes
1 answer

Apache-Cayenne Custom Query Results

To preface my question, I'm in school working on a project that has been previously worked on in past semesters. So the choices made in the design and development were something I am not 100% sure on and so I cannot comment on the reasoning behind…
Rrr
  • 3
  • 1
1 2 3
8 9