7 Replies Latest reply on Nov 15, 2007 4:02 AM by nharrison

    -Seam-gen PropertyNotFoundException after generate-entities

    nharrison

      Hi,

      I'm evaluating Seam and trying to deploy a simple app using seam-gen with a preexisting MySQL database (also tried the same with MSSQL).

      I've tried to deploy with JBoss 4.2.0 and 4.2.2 with both seam 1.2 and 2.0CR3.

      The empty shell seam-gen runs fine. After running "generate-entites" the , generated entities match the DB schema and the pages are created. But upon accessing the home page a PropertyNotFound exception occurs:

      javax.el.PropertyNotFoundException: Property 'sApplications' not found on type shippingapp.SApplicationsList_$$_javassist_0
       at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:193)


      The problem occurs when an <s:link> tag is rendered in the menu. This links to a page called: SApplicationsList.xhtml (corresponding to the SApplictions.java entity - see DDL below). Along with the xhtml page there is a SApplicationsList.page.xml file. The problem occurs there when the following is rendered, specifically, when the sApplicationsList.sApplications.shipmentCode EL is processed. This seems to suggest an issue with EJB3 / Hibernate... but I'm new to this..

      <?xml version="1.0" encoding="UTF-8"?>
      <page xmlns="http://jboss.com/products/seam/pages"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd">
      
       <param name="firstResult" value="#{sApplicationsList.firstResult}"/>
       <param name="order" value="#{sApplicationsList.order}"/>
       <param name="from"/>
       <param name="shipmentCode" value="#{sApplicationsList.sApplications.shipmentCode}"/>
       <param name="projectBrief" value="#{sApplicationsList.sApplications.projectBrief}"/>
      
      </page>


      DROP TABLE IF EXISTS `dbo`.`s_applications`;
      CREATE TABLE `dbo`.`s_applications` (
       `applicationId` int(10) unsigned NOT NULL AUTO_INCREMENT,
       `shipmentCode` varchar(45) DEFAULT NULL,
       `dateInitialContact` datetime DEFAULT NULL,
       `projectBrief` text,
       PRIMARY KEY (`applicationId`)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;



      Any clues?

      Thanks,

      Neville


        • 1. Re: -Seam-gen PropertyNotFoundException after generate-entit
          pmuir

          Post the involved entities and xhtml

          • 2. Re: -Seam-gen PropertyNotFoundException after generate-entit
            nharrison

            I've made further progress now. Here is what I've found.

            1. MySQL "LONGTEXT" columns are not mapped correctly. The workaround is to add the following annotation

            @Column(name = "Contents_Required", length=2147483647)

            2. The error in my first post is solved by configuring the SApplicationsList EntityQuery object instead of using the generated EntityQuery subclass.


            • 3. Re: -Seam-gen PropertyNotFoundException after generate-entit
              nharrison

              Here is my entity:

              package org.hk.crossroads.shippingapp.model;
              // Generated 15/11/2007 14:57:06 by Hibernate Tools 3.2.0.b10

              import java.util.Date;
              import java.util.HashSet;
              import java.util.Set;
              import javax.persistence.CascadeType;
              import javax.persistence.Column;
              import javax.persistence.Entity;
              import javax.persistence.FetchType;
              import javax.persistence.GeneratedValue;
              import static javax.persistence.GenerationType.IDENTITY;
              import javax.persistence.Id;
              import javax.persistence.OneToMany;
              import javax.persistence.Table;
              import org.hibernate.validator.Length;
              import org.hibernate.validator.NotNull;

              /**
              * SApplication generated by hbm2java
              */
              @Entity
              @Table(name = "s_application", catalog = "shipping_nh")
              public class SApplication implements java.io.Serializable {

              private Integer applicationId;
              private String shipmentCode;
              private String region;
              private String country;
              private String province;
              private String organisation;
              private String contactPerson;
              private String projectType;
              private String projectBrief;
              private String contentsRequired;
              private String stateOfRegistration;
              private String oldForms;
              private String statusOfApplication;
              private String referees;
              private String outcomeOfApplication;
              private String notes;
              private String reviewFeedback;
              private String status;
              private Date dateEntered;
              private String enteredByUser;
              private String updatedByUser;
              private Date dateLastUpdated;
              private Set SCorrespondences = new HashSet(
              0);


              public SApplication() {
              }

              public SApplication(String shipmentCode, Date dateEntered,
              Date dateLastUpdated) {
              this.shipmentCode = shipmentCode;
              this.dateEntered = dateEntered;
              this.dateLastUpdated = dateLastUpdated;
              }
              public SApplication(String shipmentCode, String region, String country,
              String province, String organisation, String contactPerson,
              String projectType, String projectBrief, String contentsRequired,
              String stateOfRegistration, String oldForms,
              String statusOfApplication, String referees,
              String outcomeOfApplication, String notes, String reviewFeedback,
              String status, Date dateEntered, String enteredByUser,
              String updatedByUser, Date dateLastUpdated,
              Set SCorrespondences,
              Set SCorrespondences_1) {
              this.shipmentCode = shipmentCode;
              this.region = region;
              this.country = country;
              this.province = province;
              this.organisation = organisation;
              this.contactPerson = contactPerson;
              this.projectType = projectType;
              this.projectBrief = projectBrief;
              this.contentsRequired = contentsRequired;
              this.stateOfRegistration = stateOfRegistration;
              this.oldForms = oldForms;
              this.statusOfApplication = statusOfApplication;
              this.referees = referees;
              this.outcomeOfApplication = outcomeOfApplication;
              this.notes = notes;
              this.reviewFeedback = reviewFeedback;
              this.status = status;
              this.dateEntered = dateEntered;
              this.enteredByUser = enteredByUser;
              this.updatedByUser = updatedByUser;
              this.dateLastUpdated = dateLastUpdated;
              this.SCorrespondences = SCorrespondences;
              this.SCorrespondences_1 = SCorrespondences_1;
              }

              @Id
              @GeneratedValue(strategy = IDENTITY)
              @Column(name = "Application_ID", unique = true, nullable = false)
              public Integer getApplicationId() {
              return this.applicationId;
              }

              public void setApplicationId(Integer applicationId) {
              this.applicationId = applicationId;
              }

              @Column(name = "Shipment_Code", nullable = false, length = 10)
              @NotNull
              @Length(max = 10)
              public String getShipmentCode() {
              return this.shipmentCode;
              }

              public void setShipmentCode(String shipmentCode) {
              this.shipmentCode = shipmentCode;
              }

              @Column(name = "Region", length = 25)
              @Length(max = 25)
              public String getRegion() {
              return this.region;
              }

              public void setRegion(String region) {
              this.region = region;
              }

              @Column(name = "Country", length = 100)
              @Length(max = 100)
              public String getCountry() {
              return this.country;
              }

              public void setCountry(String country) {
              this.country = country;
              }

              @Column(name = "Province", length = 100)
              @Length(max = 100)
              public String getProvince() {
              return this.province;
              }

              public void setProvince(String province) {
              this.province = province;
              }

              @Column(name = "Organisation")
              public String getOrganisation() {
              return this.organisation;
              }

              public void setOrganisation(String organisation) {
              this.organisation = organisation;
              }

              @Column(name = "Contact_Person")
              public String getContactPerson() {
              return this.contactPerson;
              }

              public void setContactPerson(String contactPerson) {
              this.contactPerson = contactPerson;
              }

              @Column(name = "Project_Type", length = 50)
              @Length(max = 50)
              public String getProjectType() {
              return this.projectType;
              }

              public void setProjectType(String projectType) {
              this.projectType = projectType;
              }

              @Column(name = "Project_Brief", length=2147483647)
              public String getProjectBrief() {
              return this.projectBrief;
              }

              public void setProjectBrief(String projectBrief) {
              this.projectBrief = projectBrief;
              }

              @Column(name = "Contents_Required", length=2147483647)
              public String getContentsRequired() {
              return this.contentsRequired;
              }

              public void setContentsRequired(String contentsRequired) {
              this.contentsRequired = contentsRequired;
              }

              @Column(name = "State_Of_Registration")
              public String getStateOfRegistration() {
              return this.stateOfRegistration;
              }

              public void setStateOfRegistration(String stateOfRegistration) {
              this.stateOfRegistration = stateOfRegistration;
              }

              @Column(name = "Old_Forms")
              public String getOldForms() {
              return this.oldForms;
              }

              public void setOldForms(String oldForms) {
              this.oldForms = oldForms;
              }

              @Column(name = "Status_Of_Application", length = 50)
              @Length(max = 50)
              public String getStatusOfApplication() {
              return this.statusOfApplication;
              }

              public void setStatusOfApplication(String statusOfApplication) {
              this.statusOfApplication = statusOfApplication;
              }

              @Column(name = "Referees", length=2147483647)
              public String getReferees() {
              return this.referees;
              }

              public void setReferees(String referees) {
              this.referees = referees;
              }

              @Column(name = "Outcome_Of_Application")
              public String getOutcomeOfApplication() {
              return this.outcomeOfApplication;
              }

              public void setOutcomeOfApplication(String outcomeOfApplication) {
              this.outcomeOfApplication = outcomeOfApplication;
              }

              @Column(name = "Notes", length=2147483647)
              public String getNotes() {
              return this.notes;
              }

              public void setNotes(String notes) {
              this.notes = notes;
              }

              @Column(name = "Review_Feedback", length=2147483647)
              public String getReviewFeedback() {
              return this.reviewFeedback;
              }

              public void setReviewFeedback(String reviewFeedback) {
              this.reviewFeedback = reviewFeedback;
              }

              @Column(name = "Status", length = 25)
              @Length(max = 25)
              public String getStatus() {
              return this.status;
              }

              public void setStatus(String status) {
              this.status = status;
              }

              @Column(name = "Date_Entered", nullable = false, length = 0)
              @NotNull
              public Date getDateEntered() {
              return this.dateEntered;
              }

              public void setDateEntered(Date dateEntered) {
              this.dateEntered = dateEntered;
              }

              @Column(name = "Entered_By_User", length = 50)
              @Length(max = 50)
              public String getEnteredByUser() {
              return this.enteredByUser;
              }

              public void setEnteredByUser(String enteredByUser) {
              this.enteredByUser = enteredByUser;
              }

              @Column(name = "Updated_By_User", length = 50)
              @Length(max = 50)
              public String getUpdatedByUser() {
              return this.updatedByUser;
              }

              public void setUpdatedByUser(String updatedByUser) {
              this.updatedByUser = updatedByUser;
              }

              @Column(name = "Date_Last_Updated", nullable = false, length = 0)
              @NotNull
              public Date getDateLastUpdated() {
              return this.dateLastUpdated;
              }

              public void setDateLastUpdated(Date dateLastUpdated) {
              this.dateLastUpdated = dateLastUpdated;
              }
              @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "SApplication")
              public Set getSCorrespondences() {
              return this.SCorrespondences;
              }


              }

              And here is the generated EntityHome:


              package org.hk.crossroads.shippingapp.action;

              import org.hk.crossroads.shippingapp.model.*;
              import java.util.ArrayList;
              import java.util.List;
              import org.jboss.seam.annotations.Name;
              import org.jboss.seam.framework.EntityHome;

              @Name("sApplicationHome")
              public class SApplicationHome extends EntityHome {

              public void setApplicationId(Integer id) {
              setId(id);
              }

              public Integer setApplicationId() {
              return (Integer) getId();
              }

              @Override
              protected SApplication createInstance() {
              SApplication sApplication = new SApplication();
              return sApplication;
              }

              public void wire() {
              }

              public boolean isWired() {
              return true;
              }

              public SApplication getDefinedInstance() {
              return isIdDefined() ? getInstance() : null;
              }

              public List getSCorrespondences() {
              return getInstance() == null ? null : new ArrayList(
              getInstance().getSCorrespondences());
              }

              }

              And, finally, here is the generated EntityQuery that, I think, is broken

              package org.hk.crossroads.shippingapp.action;

              import org.hk.crossroads.shippingapp.model.*;
              import org.jboss.seam.annotations.Name;
              import org.jboss.seam.framework.EntityQuery;
              import java.util.List;
              import java.util.Arrays;

              @Name("sApplicationList")
              public class SApplicationList extends EntityQuery {

              private static final String[] RESTRICTIONS = {
              "lower(sApplication.shipmentCode) like concat(lower(#{sApplicationList.sApplication.shipmentCode}),'%')",
              "lower(sApplication.region) like concat(lower(#{sApplicationList.sApplication.region}),'%')",
              "lower(sApplication.country) like concat(lower(#{sApplicationList.sApplication.country}),'%')",
              "lower(sApplication.province) like concat(lower(#{sApplicationList.sApplication.province}),'%')",
              "lower(sApplication.organisation) like concat(lower(#{sApplicationList.sApplication.organisation}),'%')",
              "lower(sApplication.contactPerson) like concat(lower(#{sApplicationList.sApplication.contactPerson}),'%')",
              "lower(sApplication.projectType) like concat(lower(#{sApplicationList.sApplication.projectType}),'%')",
              "lower(sApplication.projectBrief) like concat(lower(#{sApplicationList.sApplication.projectBrief}),'%')",
              "lower(sApplication.contentsRequested) like concat(lower(#{sApplicationList.sApplication.contentsRequested}),'%')",
              "lower(sApplication.stateOfRegistration) like concat(lower(#{sApplicationList.sApplication.stateOfRegistration}),'%')",
              "lower(sApplication.oldForms) like concat(lower(#{sApplicationList.sApplication.oldForms}),'%')",
              "lower(sApplication.statusOfApplication) like concat(lower(#{sApplicationList.sApplication.statusOfApplication}),'%')",
              "lower(sApplication.referees) like concat(lower(#{sApplicationList.sApplication.referees}),'%')",
              "lower(sApplication.outcomeOfApplication) like concat(lower(#{sApplicationList.sApplication.outcomeOfApplication}),'%')",
              "lower(sApplication.notes) like concat(lower(#{sApplicationList.sApplication.notes}),'%')",
              "lower(sApplication.reviewFeedback) like concat(lower(#{sApplicationList.sApplication.reviewFeedback}),'%')",
              "lower(sApplication.expectations) like concat(lower(#{sApplicationList.sApplication.expectations}),'%')",
              "lower(sApplication.status) like concat(lower(#{sApplicationList.sApplication.status}),'%')",
              "lower(sApplication.enteredByUser) like concat(lower(#{sApplicationList.sApplication.enteredByUser}),'%')",
              "lower(sApplication.updatedByUser) like concat(lower(#{sApplicationList.sApplication.updatedByUser}),'%')",};

              private SApplication sApplication = new SApplication();

              @Override
              public String getEjbql() {
              return "select sApplication from SApplication sApplication";
              }

              @Override
              public Integer getMaxResults() {
              return 25;
              }

              public SApplication getSApplication() {
              return sApplication;
              }

              @Override
              public List getRestrictions() {
              return Arrays.asList(RESTRICTIONS);
              }

              }

              • 4. Re: -Seam-gen PropertyNotFoundException after generate-entit
                voreichel
                • 5. Re: -Seam-gen PropertyNotFoundException after generate-entit
                  nharrison

                  I should point out that I've switch to 2.0.0 GA with the same issues...

                  • 6. Re: -Seam-gen PropertyNotFoundException after generate-entit
                    voreichel

                     

                    "nharrison" wrote:
                    I've made further progress now. Here is what I've found.

                    2. The error in my first post is solved by configuring the SApplicationsList EntityQuery object instead of using the generated EntityQuery subclass.




                    What do you mean by "configuring the SApplicationsListEntityQuery"?

                    • 7. Re: -Seam-gen PropertyNotFoundException after generate-entit
                      nharrison

                      Ahh. I had no joy with the generated class used for object list and search. This class, SApplicationsListEntityQuery is a subclass of "EntityQuery" from the seam framework. It did not work for me but I was able to get a list of data after configuring an equivalent type in "component.xml" ie

                      <framework:entity-query name="sApplicationList"
                      ejbql="select app from SApplication app"
                      order="shipmentCode">

                      <framework:restrictions>

                      lower(app.shipmentCode) like lower(concat(#{applicationSrch.shipmentCode},'%') )
                      lower(app.region) like lower(concat(#{applicationSrch.region},'%') )
                      lower(app.country) like lower(concat(#{applicationSrch.country},'%') )
                      lower(app.contactPerson) like lower(concat(#{applicationSrch.contactPerson},'%') )
                      lower(app.status) like lower(concat(#{applicationSrch.status},'%') )

                      </framework:restrictions>

                      </framework:entity-query>