fixed some code
This commit is contained in:
parent
552b2b2fa9
commit
2c9c96a811
|
@ -12,6 +12,8 @@ public class PersistOptionalTypeExample {
|
||||||
|
|
||||||
static EntityManager entityManager = emf.createEntityManager();
|
static EntityManager entityManager = emf.createEntityManager();
|
||||||
|
|
||||||
|
//to run this app, uncomment the follow line in META-INF/persistence.xml
|
||||||
|
//<class>com.baeldung.optionalReturnType.UserOptionalField</class>
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
UserOptionalField user1 = new UserOptionalField();
|
UserOptionalField user1 = new UserOptionalField();
|
||||||
user1.setUserId(1l);
|
user1.setUserId(1l);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import javax.persistence.EntityManager;
|
||||||
import javax.persistence.EntityManagerFactory;
|
import javax.persistence.EntityManagerFactory;
|
||||||
import javax.persistence.Persistence;
|
import javax.persistence.Persistence;
|
||||||
|
|
||||||
public class PersistUserNoOptionalExample {
|
public class PersistUserExample {
|
||||||
static String persistenceUnit = "com.baeldung.optionalReturnType";
|
static String persistenceUnit = "com.baeldung.optionalReturnType";
|
||||||
static EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnit);
|
static EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnit);
|
||||||
|
|
|
@ -9,9 +9,11 @@
|
||||||
transaction-type="RESOURCE_LOCAL">
|
transaction-type="RESOURCE_LOCAL">
|
||||||
<description>Persist Optional Return Type Demo</description>
|
<description>Persist Optional Return Type Demo</description>
|
||||||
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||||
<class>com.baeldung.optionalReturnType.UserNoOptional</class>
|
<class>com.baeldung.optionalReturnType.User</class>
|
||||||
<class>com.baeldung.optionalReturnType.UserOptional</class>
|
<class>com.baeldung.optionalReturnType.UserOptional</class>
|
||||||
|
<!--
|
||||||
<class>com.baeldung.optionalReturnType.UserOptionalField</class>
|
<class>com.baeldung.optionalReturnType.UserOptionalField</class>
|
||||||
|
-->
|
||||||
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
Loading…
Reference in New Issue