java - Are there any classes that implement javax.persistence.Parameter<T>? -
i'm using named queries fetch entities database using jpa , hibernate , came across puzzling me: how come there no default implementations of javax.persistence.parameter
interface?
i rather impressed how @staticmetamodel
used criteriabuilder in jpa2 meaning type safety , don't have mess around setting string names. wanted apply similar of jpa1 ejb's i'm working on:
dealergroup_.class: public dealergroup_ { public parameter<integer> id = new parameterimpl<integer>("id"); /// etc... } dealergroupfacade.class: // ... public dealergroup fetch(integer id) { typedquery<dealergroup> query = em.createnamedquery("dealergroup.fetchbyid", dealergroup.class); query.setparameter(dealergroup_.id, query); return query.getsingleresult(); } // ...
i surprised find there no implementations of parameter interface - of course, implement myself absence makes me suspicious may mistake using in way?
should implementing parameter? ideas why there isn't readily available implementation , why can't find many (any, really) examples of use?
that interface jpa implementation implement implementation of criteria "parameterexpression" (which extends parameter), using own implementation class. user goes via criteriabuilder.parameter()
hold of one, or via query.getparameter()
when 1 defined traditional means in query
Comments
Post a Comment