Skip to content

Commit ebe9574

Browse files
committed
JAVA-41259 Moved code of article jpa-error-java-lang-string-cannot-be-cast from java-jpa to java-jpa-4
1 parent b53a0b5 commit ebe9574

File tree

6 files changed

+18
-1
lines changed

6 files changed

+18
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ This module contains articles about the Java Persistence API (JPA) in Java.
1010
- [How to Clone a JPA Entity](https://www.baeldung.com/java-jpa-clone-entity)
1111
- [A Guide to Stored Procedures with JPA](https://www.baeldung.com/jpa-stored-procedures)
1212
- [JPA @Basic Annotation](https://www.baeldung.com/jpa-basic-annotation)
13+
- [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)

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,5 +209,22 @@
209209
<property name="show_sql" value="true" />
210210
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false" />
211211
</properties>
212+
213+
</persistence-unit> <persistence-unit name="jpa-h2">
214+
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
215+
<class>com.baeldung.jpa.stringcast.Message</class>
216+
<exclude-unlisted-classes>true</exclude-unlisted-classes>
217+
<properties>
218+
<property name="jakarta.persistence.jdbc.driver" value="org.h2.Driver" />
219+
<property name="jakarta.persistence.jdbc.url" value="jdbc:h2:mem:test;MODE=LEGACY" />
220+
<property name="jakarta.persistence.jdbc.user" value="sa" />
221+
<property name="jakarta.persistence.jdbc.password" value="" />
222+
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect" />
223+
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
224+
<property name="show_sql" value="true" />
225+
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false" />
226+
</properties>
212227
</persistence-unit>
228+
229+
213230
</persistence>

persistence-modules/java-jpa/README.md

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

77
- [A Guide to SqlResultSetMapping](https://www.baeldung.com/jpa-sql-resultset-mapping)
8-
- [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)
98
- [JPA Entity Graph](https://www.baeldung.com/jpa-entity-graph)
109
- [JPA Support for java.time Types](https://www.baeldung.com/jpa-java-time)
1110
- [Converting Between LocalDate and SQL Date](https://www.baeldung.com/java-convert-localdate-sql-date)

0 commit comments

Comments
 (0)