I'm using a parametrized named native query to initialize a collection property.
Everything seems to work fine except for the fact that hibernate passes just 
one parameter to the query which is the bean's id.

Looking at the hibernate's NamedQueryCollectionInitializer sources i found that 
:

        public void initialize(Serializable key, SessionImplementor session)
  |                     throws HibernateException {
  |             if (log.isDebugEnabled())
  |                     log.debug("initializing collection: " + 
persister.getRole()
  |                                     + " using named query: " + queryName);
  |             AbstractQueryImpl query = (AbstractQueryImpl) session
  |                             .getNamedSQLQuery(queryName);
  |             if (query.getNamedParameters().length > 0)
  |                     query.setParameter(query.getNamedParameters()[0], key, 
persister
  |                                     .getKeyType());
  |             else
  |                     query.setParameter(0, key, persister.getKeyType());
  |             
query.setCollectionKey(key).setFlushMode(FlushMode.MANUAL).list();
  |     }

which confirms that just the first parameter is applied, referring its type as 
the key one.

Is there a way to pass more than one parameter?

Thanks.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4166353#4166353

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4166353
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to