So, I'm wondering a few things after studying the JPADS sample.. I'm currently getting errors like this when running my code :
Currently my ds.xml files look like the following :
My Beans then look like the following (for example):
Here's the persistence.xml file:
Here's my server.properties file too..
One thing I noticed that I'm doing differently than the JPADS example is that it's ds.xml files also carry the fields as well as in the respective "*.java" classes.. If I'm using the JPA flavor do I need to specify the fields in both sides (ds.xml + java) like the example? Is that what is causing my issues way above? Ideas?
Code:
=== 2012-02-10 23:15:48,185 [l0-5] WARN RequestContext - dsRequest.execute() failed: javax.persistence.PersistenceException: Unable to initialize default EMF provider: com.isomorphic.jpa.EMFProviderLMT . . . Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named ds
Code:
<DataSource ID="Organization" serverConstructor="com.isomorphic.jpa.JPADataSource" beanClassName="com.mydomain.app.server.Organization" > </DataSource> <DataSource ID="Address" serverConstructor="com.isomorphic.jpa.JPADataSource" beanClassName="com.mydomain.app.server.Address" > </DataSource>
Code:
package com.mydomain.app.server; import java.io.Serializable; import java.util.Date; import java.util.List; import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; @Entity @Table (name="Address") public class Address implements Serializable { @Id @Column (nullable = false) @GeneratedValue (strategy = GenerationType.IDENTITY) private Long addressId; @Column (nullable = false) private String address; @Column (nullable = false) private String city; @Column (nullable = false) private String state; @Column (nullable = false) private String zipcode; public Address() { } public Long getAddressId() { return addressId; } public void setAddressId(Long addressId) { this.addressId = addressId; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getZipcode() { return zipcode; } public void setZipcode(String zipcode) { this.zipcode = zipcode; } } package com.mydomain.app.server; import java.io.Serializable; import java.util.Date; import java.util.List; import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToOne; import javax.persistence.Table; @Entity @Table (name="Organization") public class Organization implements Serializable { @Id @Column (nullable = false) @GeneratedValue (strategy = GenerationType.IDENTITY) private Long orgId; @Column(name = "ADDRESS_ID") private long addressId; @Column (nullable = false) private String organizationName; @Column (nullable = false) private String organizationPhone; @Column (nullable = false) private String adminName; @Column (nullable = false) private String adminPhone; @Column (nullable = false) private String adminEmail; @OneToOne(optional=false) @JoinColumn(name = "addressId", referencedColumnName="addressId", nullable=false, insertable=true, updatable=true) private Address address; public Organization() { } public Long getOrgId() { return orgId; } public void setOrgId(Long orgId) { this.orgId = orgId; } public long getAddressId() { return addressId; } public void setAddressId(long addressId) { this.addressId = addressId; } public String getOrganizationName() { return organizationName; } public void setOrganizationName(String organizationName) { this.organizationName = organizationName; } public String getOrganizationPhone() { return organizationPhone; } public void setOrganizationPhone(String organizationPhone) { this.organizationPhone = organizationPhone; } public String getAdminName() { return adminName; } public void setAdminName(String adminName) { this.adminName = adminName; } public String getAdminPhone() { return adminPhone; } public void setAdminPhone(String adminPhone) { this.adminPhone = adminPhone; } public String getAdminEmail() { return adminEmail; } public void setAdminEmail(String adminEmail) { this.adminEmail = adminEmail; } public Address getAddress() { return address; } public void setAddress(Address address) { this.address = address; } }
Code:
<?xml version="1.0" encoding="UTF-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> <persistence-unit name="ds" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <class>com.mydomain.app.server.Organization</class> <class>com.mydomain.app.server.Address</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/> <property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/> <property name="hibernate.connection.username" value="foo"/> <property name="hibernate.connection.password" value="bar"/> <property name="hibernate.connection.url" value="jdbc:postgresql://localhost/foobar"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="true"/> <property name="hibernate.max_fetch_depth" value="3"/> <property name="hibernate.hbm2ddl.auto" value="create-drop" /> </properties> </persistence-unit> </persistence>
Code:
webRoot: __AUTODETECT__ # Set this to the GWT module name. gwtModuleName: mydomain isomorphicPathRootRelative: $gwtModuleName/sc # administration apps apps.adminConsole.location: $webRoot/$gwtModuleName/sc/tools ui.adminConsole.location: $webRoot/$gwtModuleName/sc/tools sql.defaultDatabase: PostgreSQL sql.PostgreSQL.autoJoinTransactions: true sql.PostgreSQL.interface.credentialsInURL: false sql.PostgreSQL.driver.context: _container_ sql.PostgreSQL.driver.portNumber: 5432 sql.PostgreSQL.driver: org.postgresql.Driver sql.PostgreSQL.driver.driverName: postgresql sql.PostgreSQL.driver.networkProtocol: tcp sql.PostgreSQL.interface.type: driverManager sql.PostgreSQL.database.type: postgresql sql.PostgreSQL.driver.name: PostgreSQL sql.PostgreSQL.driver.driverType: thin sql.PostgreSQL.driver.serverName: localhost sql.PostgreSQL.driver.databaseName: myscrip sql.PostgreSQL.driver.user: myscrip sql.PostgreSQL.driver.password: myscrip project.datasources: $webRoot/ds project.ui: $webRoot/shared/ui project.apps: $webRoot/shared/app sql.PostgreSQL.driver.url: jpa.emfProvider: com.isomorphic.jpa.EMFProviderLMT jpa.persistenceUnitName: ds jpa.entityManager: persistence/em jpa.entityManagerFactory: persistence/emf
One thing I noticed that I'm doing differently than the JPADS example is that it's ds.xml files also carry the fields as well as in the respective "*.java" classes.. If I'm using the JPA flavor do I need to specify the fields in both sides (ds.xml + java) like the example? Is that what is causing my issues way above? Ideas?
Comment