Monday, February 18, 2013

JPA Generate Table


[EL Info]: transaction: property eclipselink.jdbc.user is deprecated, property javax.persistence.jdbc.user should be used instead.
[EL Info]: transaction: property eclipselink.jdbc.driver is deprecated, property javax.persistence.jdbc.driver should be used instead.
[EL Info]: transaction: property eclipselink.jdbc.url is deprecated, property javax.persistence.jdbc.url should be used instead.
[EL Info]: transaction: property eclipselink.jdbc.password is deprecated, property javax.persistence.jdbc.password should be used instead.
[EL Info]: transaction: property eclipselink.jdbc.user is deprecated, property javax.persistence.jdbc.user should be used instead.
[EL Info]: transaction: property eclipselink.jdbc.driver is deprecated, property javax.persistence.jdbc.driver should be used instead.
[EL Info]: transaction: property eclipselink.jdbc.url is deprecated, property javax.persistence.jdbc.url should be used instead.
[EL Info]: transaction: property eclipselink.jdbc.password is deprecated, property javax.persistence.jdbc.password should be used instead.
[EL Info]: EclipseLink, version: Eclipse Persistence Services - 2.4.1.v20121003-ad44345
[EL Fine]: connection: Detected database platform: org.eclipse.persistence.platform.database.PostgreSQLPlatform
[EL Config]: connection: Connection(513930594)--connecting(DatabaseLogin(
platform=>PostgreSQLPlatform
user name=> "serf"
datasource URL=> "jdbc:postgresql://ec2-23-22-150-215.compute-1.amazonaws.com:5432/serfdb"
))
[EL Config]: connection: Connection(452265124)--Connected: jdbc:postgresql://ec2-23-22-150-215.compute-1.amazonaws.com:5432/serfdb
User: serf
Database: PostgreSQL  Version: 9.2.2
Driver: PostgreSQL Native Driver  Version: PostgreSQL 9.2 JDBC4 (build 1002)
[EL Config]: connection: Connection(1275312335)--connecting(DatabaseLogin(
platform=>PostgreSQLPlatform
user name=> "serf"
datasource URL=> "jdbc:postgresql://ec2-23-22-150-215.compute-1.amazonaws.com:5432/serfdb"
))
[EL Config]: connection: Connection(140133638)--Connected: jdbc:postgresql://ec2-23-22-150-215.compute-1.amazonaws.com:5432/serfdb
User: serf
Database: PostgreSQL  Version: 9.2.2
Driver: PostgreSQL Native Driver  Version: PostgreSQL 9.2 JDBC4 (build 1002)
[EL Info]: connection: file:/Users/charlie/Documents/workspace2/ClinicDomain/build/classes/_ClinicDomain login successful
[EL Warning]: metamodel: The collection of metamodel types is empty. Model classes may not have been found during entity search for Java SE and some Java EE container managed persistence units.  Please verify that your entity classes are referenced in persistence.xml using either <class> elements or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element
[EL Config]: connection: Connection(452265124)--disconnect
[EL Info]: connection: file:/Users/charlie/Documents/workspace2/ClinicDomain/build/classes/_ClinicDomain logout successful
[EL Config]: connection: Connection(513930594)--disconnect
[EL Config]: connection: Connection(140133638)--disconnect

1. the tables were not created.

change 1:
modify... -> EJB Module

http://connectedweb.wordpress.com/2012/02/15/constraints-for-glassfish-deployment-descriptors-files-9-have-not-been-met-how-to-fix/
Now I can select the Platform as EclipseLink 2.4.x. In Dali tutorial, it is 1.2.x

modify the persistence.xml

Let's see what is gonna happen... 

Concole:

Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named ClinicDomain
at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:75)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:63)




PPL discuss about generating tables in forum...

Make sure that:
a. You clean your project before connecting to serfdb
b. Your persistence.xml contains every class definition
c. You build before connecting

project - > clean ... simply delete the classes been built in the build folder of the project
build project :

The "Build" is a process that covers all the steps required to create a "deliverable" of your software. In the Java world, this typically includes:
  1. Generating sources (sometimes).
  2. Compiling sources.
  3. Compiling test sources.
  4. Executing tests (unit tests, integration tests, etc).
  5. Packaging (into jar, war, ejb-jar, ear).
  6. Running health checks (static analyzers like Checkstyle, Findbugs, PMD, test coverage, etc).
  7. Generating reports.




Well, I followed it, and got:

[EL Info]: transaction: property eclipselink.jdbc.user is deprecated, property javax.persistence.jdbc.user should be used instead.
[EL Info]: transaction: property eclipselink.jdbc.driver is deprecated, property javax.persistence.jdbc.driver should be used instead.
[EL Info]: transaction: property eclipselink.jdbc.url is deprecated, property javax.persistence.jdbc.url should be used instead.
[EL Info]: transaction: property eclipselink.jdbc.password is deprecated, property javax.persistence.jdbc.password should be used instead.
[EL Config]: metadata: The access type for the persistent class [class edu.cs548.Patient] is set to [FIELD].
[EL Config]: metadata: The target entity (reference) class for the one to many mapping element [field treatments] is being defaulted to: class edu.cs548.Treatment.
[EL Config]: metadata: The access type for the persistent class [class edu.cs548.Treatment] is set to [FIELD].
[EL Config]: metadata: The target entity (reference) class for the many to one mapping element [field patient] is being defaulted to: class edu.cs548.Patient.
[EL Config]: metadata: The target entity (reference) class for the many to one mapping element [field provider] is being defaulted to: class edu.cs548.Provider.
[EL Config]: metadata: The access type for the persistent class [class edu.cs548.RadiologyTreatment] is set to [FIELD].
[EL Config]: metadata: The access type for the persistent class [class edu.cs548.DrugTreatment] is set to [FIELD].
[EL Config]: metadata: The access type for the persistent class [class edu.cs548.SurgeryTreatment] is set to [FIELD].
[EL Config]: metadata: The access type for the persistent class [class edu.cs548.Provider] is set to [FIELD].
[EL Config]: metadata: The target entity (reference) class for the one to many mapping element [field treatments] is being defaulted to: class edu.cs548.Treatment.
[EL Config]: metadata: The alias name for the entity class [class edu.cs548.Patient] is being defaulted to: Patient.
[EL Config]: metadata: The column name for element [id] is being defaulted to: ID.
[EL Config]: metadata: The column name for element [patientId] is being defaulted to: PATIENTID.
[EL Config]: metadata: The column name for element [name] is being defaulted to: NAME.
[EL Config]: metadata: The column name for element [birthDate] is being defaulted to: BIRTHDATE.
[EL Config]: metadata: The alias name for the entity class [class edu.cs548.Treatment] is being defaulted to: Treatment.
[EL Config]: metadata: The column name for element [id] is being defaulted to: ID.
[EL Config]: metadata: The column name for element [diagnosis] is being defaulted to: DIAGNOSIS.
[EL Config]: metadata: The alias name for the entity class [class edu.cs548.RadiologyTreatment] is being defaulted to: RadiologyTreatment.
[EL Config]: metadata: The primary key column name for the inheritance class [class edu.cs548.RadiologyTreatment] is being defaulted to: ID.
[EL Config]: metadata: The foreign key column name for the inheritance class [edu.cs548.RadiologyTreatment] is being defaulted to: ID.
[EL Config]: metadata: The column name for element [RadiologyDates] is being defaulted to: RADIOLOGYDATES.
Exception in thread "main" Local Exception Stack: 
Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@714fdb76
Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [ClinicDomain] failed.
Internal Exception: Exception [EclipseLink-7165] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The type [class java.util.List] for the attribute [RadiologyDates] on the entity class [class edu.cs548.RadiologyTreatment] is not a valid type for a temporal mapping. The attribute must be defined as java.util.Date or java.util.Calendar.
at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:127)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:118)
at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.execute(Main.java:75)
at org.eclipse.jpt.jpa.eclipselink.core.ddlgen.Main.main(Main.java:63)
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [ClinicDomain] failed.
Internal Exception: Exception [EclipseLink-7165] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The type [class java.util.List] for the attribute [RadiologyDates] on the entity class [class edu.cs548.RadiologyTreatment] is not a valid type for a temporal mapping. The attribute must be defined as java.util.Date or java.util.Calendar.
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createPredeployFailedPersistenceException(EntityManagerSetupImpl.java:1541)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1532)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:98)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:108)
... 3 more
Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [ClinicDomain] failed.
Internal Exception: Exception [EclipseLink-7165] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The type [class java.util.List] for the attribute [RadiologyDates] on the entity class [class edu.cs548.RadiologyTreatment] is not a valid type for a temporal mapping. The attribute must be defined as java.util.Date or java.util.Calendar.
at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:221)
... 7 more
Caused by: Exception [EclipseLink-7165] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The type [class java.util.List] for the attribute [RadiologyDates] on the entity class [class edu.cs548.RadiologyTreatment] is not a valid type for a temporal mapping. The attribute must be defined as java.util.Date or java.util.Calendar.
at org.eclipse.persistence.exceptions.ValidationException.invalidTypeForTemporalAttribute(ValidationException.java:1128)
at org.eclipse.persistence.internal.jpa.metadata.converters.TemporalMetadata.process(TemporalMetadata.java:122)
at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.processTemporal(MappingAccessor.java:1832)
at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.processJPAConverters(MappingAccessor.java:1584)
at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.processMappingConverter(MappingAccessor.java:1652)
at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.processMappingValueConverter(MappingAccessor.java:1670)
at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.BasicAccessor.process(BasicAccessor.java:414)
at org.eclipse.persistence.internal.jpa.metadata.MetadataDescriptor.processMappingAccessors(MetadataDescriptor.java:1461)
at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.processMappingAccessors(ClassAccessor.java:1526)
at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.processMappingAccessors(EntityAccessor.java:1059)
at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.process(EntityAccessor.java:632)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage2(MetadataProject.java:1686)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:532)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:550)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1469)
... 5 more



------------------------------------------fix the RadiologyDate------------generate again-----
[EL Info]: transaction: property eclipselink.jdbc.user is deprecated, property javax.persistence.jdbc.user should be used instead.
[EL Info]: transaction: property eclipselink.jdbc.driver is deprecated, property javax.persistence.jdbc.driver should be used instead.
[EL Info]: transaction: property eclipselink.jdbc.url is deprecated, property javax.persistence.jdbc.url should be used instead.
[EL Info]: transaction: property eclipselink.jdbc.password is deprecated, property javax.persistence.jdbc.password should be used instead.
[EL Info]: transaction: property eclipselink.jdbc.user is deprecated, property javax.persistence.jdbc.user should be used instead.
[EL Info]: transaction: property eclipselink.jdbc.driver is deprecated, property javax.persistence.jdbc.driver should be used instead.
[EL Info]: transaction: property eclipselink.jdbc.url is deprecated, property javax.persistence.jdbc.url should be used instead.
[EL Info]: transaction: property eclipselink.jdbc.password is deprecated, property javax.persistence.jdbc.password should be used instead.
[EL Warning]: transaction: PersistenceUnitInfo ClinicDomain has transactionType RESOURCE_LOCAL and therefore jtaDataSource will be ignored
[EL Info]: EclipseLink, version: Eclipse Persistence Services - 2.4.1.v20121003-ad44345
[EL Config]: connection: Connection(703024953)--connecting(DatabaseLogin(
platform=>PostgreSQLPlatform
user name=> "serf"
datasource URL=> "jdbc:postgresql://ec2-23-22-150-215.compute-1.amazonaws.com:5432/serfdb"
))
[EL Config]: connection: Connection(905857246)--Connected: jdbc:postgresql://ec2-23-22-150-215.compute-1.amazonaws.com:5432/serfdb
User: serf
Database: PostgreSQL  Version: 9.2.2
Driver: PostgreSQL Native Driver  Version: PostgreSQL 9.2 JDBC4 (build 1002)
[EL Config]: connection: Connection(1231159939)--connecting(DatabaseLogin(
platform=>PostgreSQLPlatform
user name=> "serf"
datasource URL=> "jdbc:postgresql://ec2-23-22-150-215.compute-1.amazonaws.com:5432/serfdb"
))
[EL Config]: connection: Connection(1100155928)--Connected: jdbc:postgresql://ec2-23-22-150-215.compute-1.amazonaws.com:5432/serfdb
User: serf
Database: PostgreSQL  Version: 9.2.2
Driver: PostgreSQL Native Driver  Version: PostgreSQL 9.2 JDBC4 (build 1002)
[EL Info]: connection: file:/Users/charlie/Documents/workspace2/ClinicDomain/build/classes/_ClinicDomain login successful
[EL Warning]: metamodel: The collection of metamodel types is empty. Model classes may not have been found during entity search for Java SE and some Java EE container managed persistence units.  Please verify that your entity classes are referenced in persistence.xml using either <class> elements or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element
[EL Config]: connection: Connection(905857246)--disconnect
[EL Info]: connection: file:/Users/charlie/Documents/workspace2/ClinicDomain/build/classes/_ClinicDomain logout successful
[EL Config]: connection: Connection(703024953)--disconnect
[EL Config]: connection: Connection(1100155928)--disconnect

-------------forget to add class into persistence.xml again -.-!

------------again







1 comment: