JPA CriteriaContainer - PluralAttributes

I have a User class with two properties group ( one-to-one relation) and directoryNumbers (one-to-many) I created BeanTupleContainer and when I inspected the property ids in the container I only found the User.group property, I traced the code a little bit and I found that BeanTupleContainer only adds SingularAttributes and ignors PluralAttributes, how can I mange I want the container to contain User.directoryNumbers so I can use the directoryNumbers directly. Ofcourse same applies when using CriteriaContainer.


 BeanTupleQueryDefinition emptyQueryDef = new BeanTupleQueryDefinition(entityManager, true, 20) {
		@Override
		protected javax.persistence.criteria.Root<?> defineQuery(
			javax.persistence.criteria.CriteriaBuilder criteriaBuilder,
			javax.persistence.criteria.CriteriaQuery<?> criteriaQuery) {
		    Root t = criteriaQuery.from(clazz);
		    criteriaQuery.multiselect(t);
		    return t;
		};
	    };
	    BeanTupleContainer container = new BeanTupleContainer(emptyQueryDef);
	    tableContainer = container;

Honest answer is that I did not know what to do with plural attributes :*). The item property would contain a collection, and you would have to deal with displaying it properly in a table. You’re quite welcome to change the loop and give it a spin, now that I’ve learned quite a lot more about JPA there is no obvious reason I can think of why it would not work.

I have a 0.9.1 built that includes support for @IdClass, and you may therefore want to start from the trunk. I’ll try to find the time to push 0.9.1 to the directory soonish.

Thanks for your reply ,and of course for a great add-on, a work around is to add the plural property manually using container.addContainerProperty, in my case that would be [code]

container.addContainerProperty(“directoryNumbers”, Collection.class, null);

[/code]

and lazy container will handle it correctly.

Good to know that it does work with manual addition; since it does, I will try to push it through the next release (which will likely be 1.0)