Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • rle125
    replied
    Are you getting the following log when performing the fetch?

    WARN [com.isomorphic.jpa.JPADataSource] (https-jsse-nio-8443-exec-8) Field name: 'pojoId1' specified in criteria is non-persistent. Skipping.
    WARN [com.isomorphic.jpa.JPADataSource] (https-jsse-nio-8443-exec-8) Field name: 'pojoId2' specified in criteria is non-persistent. Skipping.

    I assume these are because of the following annotation parameters?

    @Column(...updatable = false, insertable = false)

    However, removing updatable and insertable results in:

    Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: app.BasePojo column: pojoId1 (should be mapped with insert="false" update="false")

    Leave a comment:


  • Isomorphic
    replied
    Based on the information provided, we were unable to reproduce the issue locally. In our environment, fetching filtered data from the described data model appears to work as expected. Could you please share complete details about all the components involved? Ideally, a standalone use case with a minimal setup that showcases the issue would be highly helpful.

    Filtering against such fields is fairly straightforward. Here's one of the criteria we used when attempting to reproduce the issue:
    Code:
    { _constructor: "AdvancedCriteria", fieldName: "pojoId1", operator: "greaterThan", value: 1 }

    Leave a comment:


  • rle125
    replied
    We tried removing the "updatable = false, insertable = false" annotations but receive errors stating they're already defined.

    We tried modifying the ds.xml to reference key.pojoId1 and key.pojoId2 through xValuePath, but receive errors stating they're not found.

    Is there a suggested approach to including these fields in a Criteria?

    Leave a comment:


  • rle125
    replied
    I updated the test case to more accurately reflect our setup.

    I added autoDeriveSchema=true and schemaBean="app.MyPojo" but get the same WARN logs:

    WARN [com.isomorphic.jpa.JPADataSource] (https-jsse-nio-8443-exec-8) Field name: 'pojoId1' specified in criteria is non-persistent. Skipping.
    WARN [com.isomorphic.jpa.JPADataSource] (https-jsse-nio-8443-exec-8) Field name: 'pojoId2' specified in criteria is non-persistent. Skipping.

    The primaryKey fields are declared both the embedded PojoKey and the BasePojo classes as shown in the test case.
    Last edited by rle125; 13 Dec 2024, 08:35.

    Leave a comment:


  • Isomorphic
    replied
    Looks like this test case is actually just abstract..

    For the actual DataSource in question, is autoDeriveSchema set? If it is, is the field public?

    If it isn't, is the field declared explicitly in the DataSource?

    Leave a comment:


  • Field name: '...' specified in criteria is non-persistent. Skipping.

    After upgrading from SmartGWT 12.1 to 13.0, we see the following WARN log and our fetches don't filter properly:

    WARN [com.isomorphic.jpa.JPADataSource] (https-jsse-nio-8443-exec-8) Field name: 'pojoId1' specified in criteria is non-persistent. Skipping.
    WARN [com.isomorphic.jpa.JPADataSource] (https-jsse-nio-8443-exec-8) Field name: 'pojoId2' specified in criteria is non-persistent. Skipping.

    The field it is referencing are the primary key fields in our POJO:

    Code:
    @Entity
    @Table(name="BasePojo")
    @Inheritance(strategy=InheritanceType.JOINED)
    @DiscriminatorColumn(name = "pojoId1", discriminatorType = DiscriminatorType.INTEGER, length = 2)
    public abstract class BasePojo  {
    
        @EmbeddedId
        private PojoKey key;
    
        @Column(name = "pojoId1", updatable = false, insertable = false)
        private int pojoId1;
    
        @Column(name = "pojoId2", updatable = false, insertable = false)
        private int pojoId2;
    }
    
    @Entity
    @Table(name = "PojoA")
    @Inheritance(strategy = InheritanceType.JOINED)
    @DiscriminatorColumn(name = "val", discriminatorType = DiscriminatorType.STRING)
    public abstract class PojoA extends BasePojo {
        @Column(name = "val", nullable = true, length = 32)
        private String val;
       ...
    }
    
    @Entity
    @Table(name="MyPojo")
    @DiscriminatorValue(value="1")
    @XmlDiscriminatorValue("1")
    public class MyPojo extends PojoA {
        ...
    }
    
    @Embeddable
    public class PojoKey implements Serializable {
    
        @Column(name = "pojoId1")
        private int pojoId1;
    
        @Column(name = "pojoId2")
        private int pojoId2;
    }
    
    @Entity
    @Embeddable
    @Table(name = "PojoB")
    @Inheritance(strategy = InheritanceType.JOINED)
    @DiscriminatorColumn(name = "field", discriminatorType = DiscriminatorType.STRING)
    @XmlAccessorType(XmlAccessType.NONE)
    public abstract class PojoB extends PojoA{
       ...
    }
    
    @Entity
    @Table(name="YourPojo")
    @DiscriminatorValue(value="2")
    @XmlAccessorType(XmlAccessType.NONE)
    @XmlDiscriminatorValue("2")
    public class YourPojo extends PojoA {
        ...
        @Embedded
        private PojoB pojoB;
    }
    And the ds.xml looks like:

    Code:
    <DataSource
            ID="myPojoDMI"
            serverConstructor="com.isomorphic.jpa.JPADataSource"
            beanClassName="app.MyPojo"
            dropExtraFields="true">
        <fields>
            <field name="pojoId1" type="integer" required="true" primaryKey="true"/>
            <field name="pojoId2" type="integer" required="true" primaryKey="true"/>
            ...
        </fields>
    </DataSource>
    
    <DataSource
            ID="yourPojoDMI"
            serverConstructor="com.isomorphic.jpa.JPADataSource"
            beanClassName="app.YourPojo"
            dropExtraFields="true">
        <fields>
            <field name="pojoId1" type="integer" required="true" primaryKey="true"/>
            <field name="pojoId2" type="integer" required="true" primaryKey="true"/>
            ...
        </fields>
    </DataSource>
    Last edited by rle125; 20 Jan 2025, 13:17.
Working...
X