Skip to content

Commit 8729227

Browse files
committed
JAVA-41259 Moved code of article jpa-sql-resultset-mapping from java-jpa to java-jpa-4
1 parent 80853ed commit 8729227

File tree

11 files changed

+24
-38
lines changed

11 files changed

+24
-38
lines changed

persistence-modules/java-jpa-4/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ This module contains articles about the Java Persistence API (JPA) in Java.
1313
- [Fixing the JPA error “java.lang.String cannot be cast to Ljava.lang.String;”](https://www.baeldung.com/jpa-error-java-lang-string-cannot-be-cast)
1414
- [Converting Between LocalDate and SQL Date](https://www.baeldung.com/java-convert-localdate-sql-date)
1515
- [JPA Support for java.time Types](https://www.baeldung.com/jpa-java-time)
16+
- [A Guide to SqlResultSetMapping](https://www.baeldung.com/jpa-sql-resultset-mapping)

persistence-modules/java-jpa-4/src/main/resources/META-INF/persistence.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@
197197

198198
<persistence-unit name="java-jpa-scheduled-day">
199199
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
200+
<class>com.baeldung.jpa.sqlresultsetmapping.ScheduledDay</class>
201+
<class>com.baeldung.jpa.sqlresultsetmapping.Employee</class>
200202
<class>com.baeldung.jpa.basicannotation.Course</class>
201203
<exclude-unlisted-classes>true</exclude-unlisted-classes>
202204
<properties>
@@ -209,8 +211,9 @@
209211
<property name="show_sql" value="true" />
210212
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false" />
211213
</properties>
214+
</persistence-unit>
212215

213-
</persistence-unit> <persistence-unit name="jpa-h2">
216+
<persistence-unit name="jpa-h2">
214217
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
215218
<class>com.baeldung.jpa.stringcast.Message</class>
216219
<exclude-unlisted-classes>true</exclude-unlisted-classes>
@@ -244,6 +247,4 @@
244247
<property name="eclipselink.logging.parameters" value="true" />
245248
</properties>
246249
</persistence-unit>
247-
248-
249250
</persistence>
Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11

22
CREATE TABLE COURSE
33
(id BIGINT,
4-
name VARCHAR(10));
4+
name VARCHAR(10));
5+
6+
CREATE TABLE EMPLOYEE
7+
(id BIGINT,
8+
name VARCHAR(10));
9+
10+
INSERT INTO EMPLOYEE VALUES (1, 'JOHN');
11+
INSERT INTO EMPLOYEE VALUES (2, 'MARY');
12+
INSERT INTO EMPLOYEE VALUES (3, 'FRANK');
13+
14+
CREATE TABLE SCHEDULE_DAYS
15+
(id IDENTITY,
16+
employeeId BIGINT,
17+
dayOfWeek VARCHAR(10));
18+
19+
INSERT INTO SCHEDULE_DAYS (employeeId, dayOfWeek) VALUES (1, 'FRIDAY');
20+
INSERT INTO SCHEDULE_DAYS (employeeId, dayOfWeek) VALUES (2, 'SATURDAY');
21+
INSERT INTO SCHEDULE_DAYS (employeeId, dayOfWeek) VALUES (3, 'MONDAY');
22+
INSERT INTO SCHEDULE_DAYS (employeeId, dayOfWeek) VALUES (3, 'FRIDAY');

persistence-modules/java-jpa/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ This module contains articles about the Java Persistence API (JPA) in Java.
44

55
### Relevant Articles
66

7-
- [A Guide to SqlResultSetMapping](https://www.baeldung.com/jpa-sql-resultset-mapping)
87
- [JPA Entity Graph](https://www.baeldung.com/jpa-entity-graph)
98
- [Composite Primary Keys in JPA](https://www.baeldung.com/jpa-composite-primary-keys)
109
- [Defining JPA Entities](https://www.baeldung.com/jpa-entities)

persistence-modules/java-jpa/src/main/resources/META-INF/persistence.xml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,6 @@
5454
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false" />
5555
</properties>
5656
</persistence-unit>
57-
<persistence-unit name="java-jpa-scheduled-day">
58-
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
59-
<class>com.baeldung.jpa.sqlresultsetmapping.ScheduledDay</class>
60-
<class>com.baeldung.jpa.sqlresultsetmapping.Employee</class>
61-
<exclude-unlisted-classes>true</exclude-unlisted-classes>
62-
<properties>
63-
<property name="jakarta.persistence.jdbc.driver" value="org.h2.Driver" />
64-
<property name="jakarta.persistence.jdbc.url" value="jdbc:h2:mem:test;MODE=LEGACY;INIT=RUNSCRIPT FROM 'classpath:database.sql'" />
65-
<property name="jakarta.persistence.jdbc.user" value="sa" />
66-
<property name="jakarta.persistence.jdbc.password" value="" />
67-
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
68-
<!--<property name="hibernate.hbm2ddl.auto" value="create-drop" /> -->
69-
<property name="show_sql" value="true" />
70-
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false" />
71-
</properties>
72-
</persistence-unit>
7357

7458
<persistence-unit name="entity-default-values">
7559
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>

0 commit comments

Comments
 (0)