[JBoss jBPM] - Re: JBPM Identity Component - QuerySyntaxException: JBPM_ID_
by varada
Thanks for responding.
If I do
Query jbpmquery = em.createQuery("select u.name from org.jbpm.identity.User as u where u.name:= username");
jbpmquery.setParameter("name", username);
User found = (User)jbpmquery.getSingleResult();
I get the following error.
22:06:29,231 WARN [QuerySplitter] no persistent classes found for query class:
select u.name from org.jbpm.identity.User as u where u.name:= username
22:06:29,231 ERROR [STDERR] javax.persistence.PersistenceException: org.hibernat
e.HibernateException: could not locate named parameter [name]
22:06:29,231 ERROR [STDERR] at org.hibernate.ejb.AbstractEntityManagerImpl.t
hrowPersistenceException(AbstractEntityManagerImpl.java:567)
22:06:29,231 ERROR [STDERR] at org.hibernate.ejb.QueryImpl.setParameter(Quer
yImpl.java:149)
Some how the identity classes are not loaded..
Any suggesstions??
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969266#3969266
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969266
19 years, 7 months
[JBoss AOP] - change text with interceptors
by sviluppatorefico
hi....how I can automatically modify a parameter of 'set' methods? I thought to use a configuration of this type:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
| <aop>
| <interceptor class="segn.util.interceptor.TextFormatInterceptor" scope="PER_CLASS"/>
| <bind pointcut="call(public void $instanceof{segn.util.model*}->set*(java.lang.String))">
| <interceptor-ref name="segn.util.interceptor.TextFormatInterceptor"/>
| </bind>
| </aop>
and an interceptor of this type:
public class TextFormatInterceptor implements Interceptor {
| public String getName() { return "TextFormatInterceptor"; }
|
| public Object invoke(Invocation invocation)
| throws Throwable
| {
| Object rsp = invocation.invokeNext();
| return rsp;
| }
| }
I have two question:
1- is it right to use an interceptor to format text of 'set' methods of a POJO?
2 - if yes, how I can to do it, seeing that the new org.jboss.aop.joinpoint.Invocation class don't permit the access of info of MethodInvocation?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969263#3969263
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969263
19 years, 7 months
[EJB 3.0] - Re: Detach entities - Obtaining a clear pojo
by ALRubinger
Not sure if I'm necessarily understanding the issue but...
Most times we encounter a LazyInitilizationException when trying to iterate over relationships outside the scope of the session/transaction; when sent to a remote client, for example.
In these cases I like to call on a little utility method to ensure the association's objects are stored in a Collection of type I dictate:
| class PersistenceUtils
|
| /**
| * Returns a Collection of all objects in the specified persistentCollection
| * without binding to any persistence context or session.
| *
| * @param <T>
| * @param targetCollection
| * @param persistentCollection
| * @return
| */
| public static <T> Collection<T> getCollectionItemsRemovedFromPersistenceContext(
| Collection<T> targetCollection, Collection<T> persistentCollection) {
| // If runtime type of persistentCollection is not PersistentCollection,
| // take no action
| if (!(persistentCollection instanceof PersistentCollection))
| return persistentCollection;
|
| // Clear existing target
| targetCollection.clear();
|
| // Place all items in persistent collection into target
| for (T item : persistentCollection) {
| targetCollection.add(item);
| }
|
| // Return target
| return targetCollection;
| }
...and I can easily call it by:
Collection<MyType> associations = new ArrayList<MyType>();
|
| associations = PersistenceUtils
| .getCollectionItemsRemovedFromPersistenceContext(
| associations,
| myAttachedObject.getAttachedAssociations());
|
...also, while responding here, found this post with a similar solution:
http://www.mojavelinux.com/blog/archives/2006/06/hibernate_get_out_of_my_...
S,
ALR
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969262#3969262
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969262
19 years, 7 months