Skip to content

Commit 82985fc

Browse files
committed
Update README as well
1 parent f7be1d0 commit 82985fc

File tree

1 file changed

+48
-14
lines changed

1 file changed

+48
-14
lines changed

README.md

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,19 @@ and properties; especially lazy-loading aspects.
99

1010
As of version 2.0 module is usable and used by non-trivial number of developers and projects.
1111

12-
Note: Hibernate 4.x and 5.x are supported (5.x starting with Jackson 2.6),
13-
but they require different jar, and Maven artifact names (and jar names differ).
14-
This document refers to "Hibernate 5" version, but changes with 4.x should require
15-
little more than replacing "5" in names with "4".
12+
Note: Hibernate 4.x, 5.x, 6.x and 7.x are supported (5.x starting with Jackson 2.6; 6.x with Jackson 2.15 and 7.x with Jackson 2.20) but they require different jars, and Maven artifact names (and jar names differ).
13+
14+
This document refers to "Hibernate 5" version, but changes with 4.x/6.x/7.x should require
15+
little more than replacing "5" in names with "4", "6" or "7".
1616

1717
Hibernate 3.x was supported up to Jackson 2.12 but is no longer supported at and after 2.13
1818

1919
Jackson 2.13 adds Support for "Hibernate 5 Jakarta" variant (for Hibernate 5.5 and beyond);
2020
see below for more information.
2121

22-
Jackson 2.15 adds Support for Hibernate 6.x;
23-
see below for more information.
22+
Jackson 2.15 adds Support for Hibernate 6.x; see below for more information.
23+
24+
Jackson 2.20 adds Support for Hibernate 7.x; see below for more information.
2425

2526
### JDK requirements
2627

@@ -31,6 +32,10 @@ With Jackson 2.15, JDK 11 will be required to build: all modules run on
3132
Java 8 except for Hibernate 6.x module which requires Java 11 like
3233
Hibernate 6.x itself.
3334

35+
With Jackson 2.20, JDK 17 will be required to build: 4.x and 5.x modules run on
36+
Java 8, 6.x on 11 and Hibernate 7.x module requires Java 17 like
37+
Hibernate 7.x itself.
38+
3439
### Javax vs Jakarta
3540

3641
Due to changes related to
@@ -54,7 +59,7 @@ To use module on Maven-based projects, use following dependency
5459
<dependency>
5560
<groupId>com.fasterxml.jackson.datatype</groupId>
5661
<artifactId>jackson-datatype-hibernate5</artifactId>
57-
<version>2.14.2</version>
62+
<version>2.19.1</version>
5863
</dependency>
5964
```
6065

@@ -66,7 +71,7 @@ Note that you need to use "jackson-datatype-hibernate4" for Hibernate 4.x.
6671
<dependency>
6772
<groupId>com.fasterxml.jackson.datatype</groupId>
6873
<artifactId>jackson-datatype-hibernate4</artifactId>
69-
<version>2.14.2</version>
74+
<version>2.19.1</version>
7075
</dependency>
7176
```
7277

@@ -77,17 +82,28 @@ you will need the jakarta suffixed dependency for Hibernate 5.5:
7782
<dependency>
7883
<groupId>com.fasterxml.jackson.datatype</groupId>
7984
<artifactId>jackson-datatype-hibernate5-jakarta</artifactId>
80-
<version>2.14.2</version>
85+
<version>2.19.1</version>
8186
</dependency>
8287
```
8388

84-
you will need to use "jackson-datatype-hibernate6" for Hibernate 6.x (when v2.15.0 is released):
89+
but you will need to use "jackson-datatype-hibernate6" for Hibernate 6.x:
90+
(for which only "jakarta" version exists).
8591

8692
```xml
8793
<dependency>
8894
<groupId>com.fasterxml.jackson.datatype</groupId>
8995
<artifactId>jackson-datatype-hibernate6</artifactId>
90-
<version>2.15.0</version>
96+
<version>2.19.1</version>
97+
</dependency>
98+
```
99+
100+
and finally, for Hibernate 7.x
101+
102+
```xml
103+
<dependency>
104+
<groupId>com.fasterxml.jackson.datatype</groupId>
105+
<artifactId>jackson-datatype-hibernate7</artifactId>
106+
<version>2.19.1</version>
91107
</dependency>
92108
```
93109

@@ -99,12 +115,30 @@ Like all standard Jackson modules (libraries that implement Module interface), r
99115
ObjectMapper mapper = new ObjectMapper();
100116
// for Hibernate 4.x:
101117
mapper.registerModule(new Hibernate4Module());
118+
// OR newer style
119+
ObjectMapper mapper = JsonMapper.builder()
120+
.addModule(new Hibernate4Module()));
121+
.build();
122+
102123
// or, for Hibernate 5.x
103-
mapper.registerModule(new Hibernate5Module());
124+
ObjectMapper mapper = JsonMapper.builder()
125+
.addModule(new Hibernate5Module()));
126+
.build();
127+
104128
// or, for Hibernate 5.5+ with Jakarta
105-
mapper.registerModule(new Hibernate5JakartaModule());
129+
ObjectMapper mapper = JsonMapper.builder()
130+
.addModule(new Hibernate5JakartaModule()));
131+
.build();
132+
106133
// or, for Hibernate 6.x
107-
mapper.registerModule(new Hibernate6Module());
134+
ObjectMapper mapper = JsonMapper.builder()
135+
.addModule(new Hibernate6Module()));
136+
.build();
137+
138+
// or, for Hibernate 7.x
139+
ObjectMapper mapper = JsonMapper.builder()
140+
.addModule(new Hibernate7Module()));
141+
.build();
108142
```
109143

110144
after which functionality is available for all normal Jackson operations.

0 commit comments

Comments
 (0)