apache-cayenne

Finding a list of related objects by ID

与世无争的帅哥 提交于 2020-01-06 11:10:44
问题 Let's say for example I have a bridge table called PersonAnimal . I want to search for all the people who have a given animal's ID. The query so far looks like: Animal animal = getById(Animal.class, animalId) ObjectSelect .query(PersonAnimal.class) .where(PersonAnimal.ANIMAL.eq(animal)) .select(context) However the first line in the above code segment shows that I first have to retrieve the related object from the database. I want to get rid of that database lookup and instead do something

stored procedure 'auto_pk_for_table' not found

痴心易碎 提交于 2019-12-25 09:11:29
问题 I don't know why I received the error : org.apache.cayenne.CayenneRuntimeException: [v.4.0.M5 Feb 24 2017 07:47:55] Commit Exception [...] Caused by: java.sql.SQLException: Procédure stockée 'auto_pk_for_table' introuvable. [...] I'm using Cayenne : <dependency> <groupId>org.apache.cayenne</groupId> <artifactId>cayenne-server</artifactId> <version>4.0.M5</version> </dependency> and JDTS for sql server : <dependency> <groupId>net.sourceforge.jtds</groupId> <artifactId>jtds</artifactId>

Updating an object to the database using Apache Cayenne

孤街浪徒 提交于 2019-12-14 03:59:51
问题 I am using Cayenne in a project for the first time. Till now, i was using the SelectQuery and was loving it. I now need to update an object e.g. my User object contains an emailId attribute. When the user needs to update his/her email, i take the existing User object and update the emailId attribute with the new value provided by the user. The problem starts now, where i don't understand the way to persist the update to the database. The options i have seem to be limited to SQLTemplate or

Apache Cayenne: supplying dynamically generated project definition

北战南征 提交于 2019-12-14 03:22:20
问题 following on from this question: Apache Cayenne: user-defined tables: examples? As part of my design, I'm intending to allow operations which modify the database schema at run time. As discussed in the above question, it does seem that Cayenne supports this. I was interested in how I can supply my new project definition to the ServerRuntime, without using the file system. After looking at the source it looks as though I have two options: (1) Implement a custom classloader, set it as the

Apache Cayenne ROP Server “No session associated with request.” on Tomcat 7

 ̄綄美尐妖づ 提交于 2019-12-11 09:36:59
问题 I develop a cayenne project with a java rich client and an remote obejct persistence server. If i the rich cient connects with a Cayenne-ROP-Server that is deployed on the same machine on localhost (on Jetty from maven goal like explained inside the cayenne rop tutorial) everythings fine: ClientConnection clientConnection = new HessianConnection("http://localhost:8080/rop.server /cayenne-service", "cayenne-user", "secret", SHARED_CAYENNE_SESSION_NAME); DataChannel channel = new ClientChannel

Apache Cayenne / PostgreSQL: “too many clients already” error

£可爱£侵袭症+ 提交于 2019-12-11 08:26:23
问题 I'm using Apache Cayenne 4 Milestone 5 and I'm getting this error. The application is not officially deployed but it is being tested within the IntelliJ IDEA. Apr 03, 2017 10:19:58 PM org.postgresql.Driver connect SEVERE: Connection error: org.postgresql.util.PSQLException: FATAL: sorry, too many clients already at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:438) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl

Cayenne, Postgres: primary key generation

一笑奈何 提交于 2019-12-08 13:10:10
问题 I'm using Cayenne 3.2M1 and Postgres 9.0.1 to create a database. Right now I'm having problems with the primary key generation of Cayenne since I have tables with more than one primary key and as far as I've read Cayenne cant generate more that one primary key per table. So I want the Postgres to do that work. I have this table: CREATE TABLE telefonocliente ( cod_cliente integer NOT NULL DEFAULT currval('cliente_serial'::regclass), cod_telefono integer NOT NULL DEFAULT nextval(

Apache Cayenne: user-defined tables: examples?

点点圈 提交于 2019-12-04 06:19:37
问题 I'm looking at Apache Cayenne as my ORM layer for a new application. Part of my DB model will be defined in a fixed model which will be known at compile time. However, another part of the model will be defined at runtime by certain limited user operations. So, these operations will have the effect of creating certain simple tables, adding and removing columns from these tables, deleting tables etc. It does seem that Cayenne is well-suited to this, based on its generic persistent objects

Cayenne 3.1 - setting datasource dynamically

梦想与她 提交于 2019-12-01 07:55:23
问题 I'm using Cayenne 3.1B2 at present as the persistence layer for some web services. There's a requirement for the services to expose one of several databases, all with the same schema, the database being determined when the service operation is invoked. The decision on which database is used needs to be based on the identity of the client invoking the service. How would I go about defining this and using it at runtime? It seems like I should define 2 datanodes, both referring to the same