[hibernate-issues] [JIRA] (HHH-14127) HHH000474 error on Boolean attribute with get and is getters and transient element not working for methods while mapping class on orm.xml

Elielson Silva (JIRA) jira at hibernate.atlassian.net
Wed Jul 29 20:35:02 EDT 2020


Elielson Silva ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A98dfdecf-f7b2-4020-8c6a-7742bccc0fba ) *created* an issue

Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNTI2ZWI1Y2RlMGZiNGFjYzk1ZDI0N2NjMmUzZjAyYjYiLCJwIjoiaiJ9 ) / Bug ( https://hibernate.atlassian.net/browse/HHH-14127?atlOrigin=eyJpIjoiNTI2ZWI1Y2RlMGZiNGFjYzk1ZDI0N2NjMmUzZjAyYjYiLCJwIjoiaiJ9 ) HHH-14127 ( https://hibernate.atlassian.net/browse/HHH-14127?atlOrigin=eyJpIjoiNTI2ZWI1Y2RlMGZiNGFjYzk1ZDI0N2NjMmUzZjAyYjYiLCJwIjoiaiJ9 ) HHH000474 error on Boolean attribute with get and is getters and transient element not working for methods while mapping class on orm.xml ( https://hibernate.atlassian.net/browse/HHH-14127?atlOrigin=eyJpIjoiNTI2ZWI1Y2RlMGZiNGFjYzk1ZDI0N2NjMmUzZjAyYjYiLCJwIjoiaiJ9 )

Issue Type: Bug Affects Versions: 5.4.19 Assignee: Unassigned Created: 29/Jul/2020 17:35 PM Priority: Major Reporter: Elielson Silva ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A98dfdecf-f7b2-4020-8c6a-7742bccc0fba )

My orm.xml file despite that listing and allowing me to use the `transient` tag to a method, the transient state is not being applied to this method, as it would be if it was on the @Transient.
Due to that and I'm getting an error:
```
HHH000474: Ambiguous persistent property methods detected on model.Test; mark one as @Transient : [public java.lang.Boolean model.Test.getDefaultProfile()] and [public java.lang.Boolean model.Test.isDefaultProfile()] : origin(model.Test)
```
And also a warning:
```
WARN: HHH000207: Property model.Test.getDefaultProfile not found in class but described in <mapping-file/> (possible typo error)
```

This is how is my orml.xml, which I was expecting to solve the error with the <transient> tag

<?xml version= "1.0" encoding= "UTF-8" ?>
<entity-mappings version= "2.1"
                xmlns= "http://xmlns.jcp.org/xml/ns/persistence/orm"
                xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation= "http://xmlns.jcp.org http://xmlns.jcp.org/xml/ns/persistence/orm_2_1.xsd" >

   <entity class= "model.Test" >
       <attributes>
           <id name= "id" />
           <transient name= "getDefaultProfile" />
       </attributes>
   </entity>

</entity-mappings>

And this is the class, that has a Boolean object on it and has the `get` and `is` implemented on it. And on the real scenario due to being a class from an external dependency, I'm using XML mapping over it:

public class Test {
   protected Integer id;
   protected Boolean defaultProfile;

   public Integer getId() {
       return id;
   }
   public void setId( Integer id) {
       this.id = id;
   }
   public Boolean getDefaultProfile() {
       return this.defaultProfile;
   }
   public Boolean isDefaultProfile() {
       return this.defaultProfile;
   }
   public void setDefaultProfile( Boolean value) {
       this.defaultProfile = value;
   }
}

And the very off from this is that if I just annotate the class with @Entity that error will not be shown

( https://hibernate.atlassian.net/browse/HHH-14127#add-comment?atlOrigin=eyJpIjoiNTI2ZWI1Y2RlMGZiNGFjYzk1ZDI0N2NjMmUzZjAyYjYiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-14127#add-comment?atlOrigin=eyJpIjoiNTI2ZWI1Y2RlMGZiNGFjYzk1ZDI0N2NjMmUzZjAyYjYiLCJwIjoiaiJ9 )

Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100140- sha1:42b370d )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200730/b2a66c34/attachment.html 


More information about the hibernate-issues mailing list