Skip to content

Commit d80004a

Browse files
committed
cleaner README, focused on 5.0
1 parent 9f7c87d commit d80004a

1 file changed

Lines changed: 22 additions & 156 deletions

File tree

README.md

Lines changed: 22 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
specific language governing permissions and limitations
1717
under the License.
1818
-->
19-
Apache Cayenne
20-
==============
19+
# Apache Cayenne
2120

2221
[![Maven Central](https://img.shields.io/maven-central/v/org.apache.cayenne/cayenne-server/4.2.svg)](https://cayenne.apache.org/download/)
2322
[![Build Status](https://github.com/apache/cayenne/actions/workflows/verify-deploy-on-push.yml/badge.svg?branch=master)](https://github.com/apache/cayenne/actions/workflows/verify-deploy-on-push.yml)
@@ -29,143 +28,37 @@ Apache Cayenne
2928

3029
[Apache Cayenne](https://cayenne.apache.org) is an open source persistence framework licensed under the Apache License, providing object-relational mapping (ORM) and remoting services.
3130

32-
Table Of Contents
33-
-----------------
3431

35-
* [Quick Start](#quick-start)
36-
* [Create Project](#create-xml-mapping)
37-
* [Cayenne Modeler](#modeler-gui-application)
38-
* [Maven plugin](#maven-plugin)
39-
* [Gradle plugin](#gradle-plugin)
40-
* [Include Cayenne Into Project](#include-cayenne-into-project)
41-
* [Create Cayenne Runtime](#create-cayenne-runtime)
42-
* [Create New Objects](#create-new-objects)
43-
* [Queries](#queries)
44-
* [Select Objects](#select-objects)
45-
* [Aggregate Functions](#aggregate-functions)
46-
* [Raw SQL queries](#raw-sql-queries)
47-
* [Documentation](#documentation)
48-
* [About](#about)
49-
* [License](#license)
50-
* [Collaboration](#collaboration)
32+
## Quick Links
5133

34+
* Getting Started https://cayenne.apache.org/docs/5.0/getting-started-guide/
35+
* Getting Started DB-First https://cayenne.apache.org/docs/5.0/getting-started-db-first/
36+
* Documentation https://cayenne.apache.org/docs/5.0/cayenne-guide/
37+
* Upgrading from Older Cayenne [UPGRADE.md](UPGRADE.md)
5238

53-
Quick Start
54-
----------------
39+
## Quick Start
5540

56-
#### Create XML mapping
57-
58-
##### Modeler GUI application
59-
60-
You can use Cayenne Modeler to manually create Cayenne project without DB.
61-
Binary distributions can be downloaded from https://cayenne.apache.org/download/
62-
63-
[![Modeler](https://cayenne.apache.org/img/cayenne-modeler-40rc1-24b0368dc2.png)](https://cayenne.apache.org/download/)
41+
### Create XML Mapping
6442

43+
Downloaded Cayenne Modeler from https://cayenne.apache.org/download/, start it and create a Cayenne project.
6544
See tutorial https://cayenne.apache.org/docs/4.2/getting-started-guide/
6645

67-
##### Maven plugin
68-
69-
Additionally, you can use Cayenne Maven (or [Gradle](#gradle-plugin)) plugin to create model based on existing DB structure.
70-
Here is example of Cayenne Maven plugin setup that will do it:
71-
72-
```xml
73-
<plugin>
74-
<groupId>org.apache.cayenne.plugins</groupId>
75-
<artifactId>cayenne-maven-plugin</artifactId>
76-
<version>4.2.1</version>
77-
78-
<dependencies>
79-
<dependency>
80-
<groupId>com.mysql</groupId>
81-
<artifactId>mysql-connector-j</artifactId>
82-
<version>8.4.0</version>
83-
</dependency>
84-
</dependencies>
85-
86-
<configuration>
87-
<map>${project.basedir}/src/main/resources/demo.map.xml</map>
88-
<cayenneProject>${project.basedir}/src/main/resources/cayenne-demo.xml</cayenneProject>
89-
<dataSource>
90-
<url>jdbc:mysql://localhost:3306/cayenne_demo?nullNamePatternMatchesAll=true</url>
91-
<driver>com.mysql.cj.jdbc.Driver</driver>
92-
<username>user</username>
93-
<password>password</password>
94-
</dataSource>
95-
<dbImport>
96-
<defaultPackage>org.apache.cayenne.demo.model</defaultPackage>
97-
</dbImport>
98-
</configuration>
99-
</plugin>
100-
```
101-
102-
Run it:
103-
```bash
104-
mvn cayenne:cdbimport
105-
mvn cayenne:cgen
106-
```
107-
See tutorial https://cayenne.apache.org/docs/4.2/getting-started-db-first/
108-
109-
##### Gradle plugin
110-
111-
And here is example of Cayenne Gradle plugin setup:
112-
113-
```gradle
114-
buildscript {
115-
repositories {
116-
mavenCentral()
117-
}
118-
dependencies {
119-
classpath 'org.apache.cayenne.plugins:cayenne-gradle-plugin:4.2.1'
120-
classpath 'com.mysql:mysql-connector-j:8.4.0'
121-
}
122-
}
123-
124-
apply plugin: 'org.apache.cayenne'
125-
cayenne.defaultDataMap 'demo.map.xml'
126-
127-
cdbimport {
128-
cayenneProject 'cayenne-demo.xml'
129-
130-
dataSource {
131-
driver 'com.mysql.cj.jdbc.Driver'
132-
url 'jdbc:mysql://127.0.0.1:3306/cayenne_demo?nullNamePatternMatchesAll=true'
133-
username 'user'
134-
password 'password'
135-
}
136-
137-
dbImport {
138-
defaultPackage = 'org.apache.cayenne.demo.model'
139-
}
140-
}
141-
142-
cgen.dependsOn cdbimport
143-
compileJava.dependsOn cgen
144-
```
145-
146-
Run it:
147-
```bash
148-
gradlew build
149-
```
150-
151-
#### Include Cayenne into project
152-
153-
##### Maven
46+
### Include Cayenne in a Project
15447

48+
Maven
15549
```xml
15650
<dependencies>
15751
<dependency>
15852
<groupId>org.apache.cayenne</groupId>
15953
<artifactId>cayenne-server</artifactId>
160-
<version>4.2.1</version>
54+
<version>5.0-M1</version>
16155
</dependency>
16256
</dependencies>
16357
```
16458

165-
##### Gradle
166-
59+
Gradle
16760
```gradle
168-
compile group: 'org.apache.cayenne', name: 'cayenne-server', version: '4.2.1'
61+
compile group: 'org.apache.cayenne', name: 'cayenne-server', version: '5.0-M1'
16962
17063
// or, if Gradle plugin is used
17164
compile cayenne.dependency('server')
@@ -174,7 +67,7 @@ compile cayenne.dependency('server')
17467
#### Create Cayenne Runtime
17568

17669
```java
177-
ServerRuntime cayenneRuntime = ServerRuntime.builder()
70+
CayenneRuntime cayenneRuntime = CayenneRuntime.builder()
17871
.addConfig("cayenne-demo.xml")
17972
.dataSource(DataSourceBuilder
18073
.url("jdbc:mysql://localhost:3306/cayenne_demo")
@@ -185,7 +78,7 @@ ServerRuntime cayenneRuntime = ServerRuntime.builder()
18578
.build();
18679
```
18780

188-
#### Create New Objects
81+
### Create New Objects
18982

19083
```java
19184
ObjectContext context = cayenneRuntime.newContext();
@@ -212,9 +105,9 @@ stein.setGallery(metropolitan);
212105
context.commitChanges();
213106
```
214107

215-
#### Queries
108+
### Queries
216109

217-
##### Select Objects
110+
#### Select Objects
218111

219112
```java
220113
List<Painting> paintings = ObjectSelect.query(Painting.class)
@@ -223,7 +116,7 @@ List<Painting> paintings = ObjectSelect.query(Painting.class)
223116
.select(context);
224117
```
225118

226-
##### Aggregate functions
119+
#### Aggregate Functions
227120

228121
```java
229122
// this is artificial property signaling that we want to get full object
@@ -243,7 +136,7 @@ for(Object[] next : artistAndPaintingCount) {
243136

244137
```
245138

246-
##### Raw SQL queries
139+
#### Raw SQL Queries
247140

248141
```java
249142
// Selecting objects
@@ -269,42 +162,15 @@ int inserted = SQLExec
269162

270163
```
271164

272-
Documentation
273-
----------------
274-
275-
#### Getting Started
276-
277-
https://cayenne.apache.org/docs/4.2/getting-started-guide/
278-
279-
#### Getting Started Db-First
280-
281-
https://cayenne.apache.org/docs/4.2/getting-started-db-first/
282-
283-
#### Full documentation
284-
285-
https://cayenne.apache.org/docs/4.2/cayenne-guide/
286-
287-
#### JavaDoc
288-
289-
https://cayenne.apache.org/docs/4.2/api/
290-
291-
About
292-
-----
293-
165+
## About
294166
With a wealth of unique and powerful features, Cayenne can address a wide range of persistence needs. Cayenne seamlessly binds one or more database schemas directly to Java objects, managing atomic commit and rollbacks, SQL generation, joins, sequences, and more.
295167

296168
Cayenne is designed to be easy to use, without sacrificing flexibility or design. To that end, Cayenne supports database reverse engineering and generation, as well as a Velocity-based class generation engine. All of these functions can be controlled directly through the CayenneModeler, a fully functional GUI tool. No cryptic XML or annotation based configuration is required! An entire database schema can be mapped directly to Java objects within minutes, all from the comfort of the GUI-based CayenneModeler.
297169

298170
Cayenne supports numerous other features, including caching, a complete object query syntax, relationship pre-fetching, on-demand object and relationship faulting, object inheritance, database auto-detection, and generic persisted objects. Most importantly, Cayenne can scale up or down to virtually any project size. With a mature, 100% open source framework, an energetic user community, and a track record of solid performance in high-volume environments, Cayenne is an exceptional choice for persistence services.
299171

300-
Collaboration
301-
--------------
302-
172+
# Collaboration and Support
303173
* [Bug/Feature Tracker](https://issues.apache.org/jira/browse/CAY)
304174
* [Mailing lists](https://cayenne.apache.org/mailing-lists.html)
305175
* [Support](https://cayenne.apache.org/support.html)
306176
* [Contributing](https://cayenne.apache.org/how-can-i-help.html)
307-
308-
License
309-
---------
310-
Cayenne is available as free and open source under the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).

0 commit comments

Comments
 (0)