org.hibernate.collection.internal.PersistentSet' has no property 'size'


Rutula Bower

I'm doing this on a JSP page ${records.size}where the type is logged Set. Then I get this error. I checked the documentation and the size()method is in org.hibernate.collection.internal.PersistentSet. So what is the possible reason for this error?

BalusC

The syntax ${records.size}basically tells EL to print the size properties (not methods!) of the bean identified by ${records}. When EL needs to get a property, it looks for the getter method in the class behind the bean. So when the property name is size, the expected getter method is getSize(). If this method does not exist, then you will face the exception you are currently facing. See also javax.el.PropertyNotFoundException: Property 'foo' not found on type com.example.Bean .

And indeed, there is org.hibernate.collection.internal.PersistentSet no such getSize()method. i.e. it really has no sizeproperties at all. So this exception is completely correct.

Basically, you want to call that size()method, not the getter method behind the sizeproperty . Fix your EL expressions accordingly:

${records.size()}

Related


Hibernate compares PersistentSet and HashSet

Antoine I have a question. In my JUnit test, I want to test inserts in the database done by hibernate. I have an entity which has a list and I want to see if the inserted list is equal to the list I set. assertEquals(listDerogationLinux, derogation.getListDero

Hibernate PersistentSet remove() operation not working

Chacko Mathew I have a collection in parent entity like this: Class Parent { @OneToMany(mappedBy = parent, cascade = CasacadeType.ALL) Set<Child> children; } Class Child { @Column(nullable=false) @ManyToOne Parent parent; } Now the event happens, if I d

Hibernate PersistentSet remove() operation not working

Chacko Mathew I have a collection in parent entity like this: Class Parent { @OneToMany(mappedBy = parent, cascade = CasacadeType.ALL) Set<Child> children; } Class Child { @Column(nullable=false) @ManyToOne Parent parent; } Now the event happens, if I d

Hibernate PersistentSet remove() operation not working

Chacko Mathew I have a collection in parent entity like this: Class Parent { @OneToMany(mappedBy = parent, cascade = CasacadeType.ALL) Set<Child> children; } Class Child { @Column(nullable=false) @ManyToOne Parent parent; } Now the event happens, if I d

Hibernate PersistentSet remove() operation not working

Chacko Mathew I have a collection in parent entity like this: Class Parent { @OneToMany(mappedBy = parent, cascade = CasacadeType.ALL) Set<Child> children; } Class Child { @Column(nullable=false) @ManyToOne Parent parent; } Now the event happens, if I d

Filter the collection but sort by internal property

Jim: Considering that I have a collection of documents like the following, and I would like to get the information returned like this: Select all items in a campaign campaignID = 12, entries.questionscorrectin descending order (capped at 10). I've done jabs on

Filter the collection but sort by internal property

Jim: Considering that I have a collection of documents like the following, and I would like to get the information returned like this: Select all items in a campaign campaignID = 12, entries.questionscorrectin descending order (capped at 10). I've done jabs on

Filter the collection but sort by internal property

Jim: Considering that I have a collection of documents like the following, and I would like to get the information returned like this: Select all items in a campaign campaignID = 12, entries.questionscorrectin descending order (capped at 10). I've done jabs on

Filter the collection but sort by internal property

Jim: Considering that I have a collection of documents like the following, and I would like to get the information returned like this: Select all items in a campaign campaignID = 12, entries.questionscorrectin descending order (capped at 10). I've done jabs on

Filter the collection but sort by internal property

Jim: Considering that I have a collection of documents like the following, and I would like to get the information returned like this: Select all items in a campaign campaignID = 12, entries.questionscorrectin descending order (capped at 10). I've done jabs on

Filter the collection but sort by internal property

Jim: Considering that I have a collection of documents like the following, and I would like to get the information returned like this: Select all items in a campaign campaignID = 12, entries.questionscorrectin descending order (capped at 10). I've done jabs on