-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Problem with the Formula Tag
PostPosted: Wed May 31, 2006 9:10 pm 
Newbie

Joined: Tue Apr 25, 2006 10:02 am
Posts: 4
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.0
Mapping documents:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping
>
<class
name="com.ingenix.freya.rulesmanagement.model.RuleLiteImpl"
table="RULEARTIFACTDTLS"
lazy="false"
>

<id
name="ID"
column="UUID"
type="java.lang.String"
unsaved-value="null"
>
<generator class="native">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-RuleLiteImpl.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>

<property
name="ruleName"
type="java.lang.String"
update="true"
insert="true"
column="name"
/>

<property
name="lastChangedOn"
type="java.util.Date"
update="true"
insert="true"
column="LastChangedOn"
/>

<property
name="effectiveDate"
type="java.util.Date"
update="true"
insert="true"
column="effectiveDate"
/>

<property
name="expirationDate"
type="java.util.Date"
update="true"
insert="true"
column="expirationDate"
/>

<property
name="description"
type="java.lang.String"
update="true"
insert="true"
column="documentation"
/>

<property
name="rulesetNames"
type="java.util.List"
formula="(select fr.name from freya_ruleset fr, ruleset_version rv, freya_ruleset_rule frr, ruleartifactdtls r where frr.rule_iid = r.uuid and rv.ruleset_version_iid = frr.ruleset_version_iid and fr.ruleset_iid = rv.ruleset_iid and r.uuid = UUID)"
update="false"
insert="false"
/>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-RuleLiteImpl.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
tx = session.beginTransaction();
mLog.debug("Attempting to save: " + object);
result = session.save(object);
tx.commit();
Full stack trace of any exception that occurs:
org.hibernate.MappingException: Could not determine type for: java.util.List, for columns: [org.hibernate.mapping.Formula( (select fr.name from freya_ruleset fr, ruleset_version rv, freya_ruleset_rule frr, ruleartifactdtls r where frr.rule_iid = r.uuid and rv.ruleset_version_iid = frr.ruleset_version_iid and fr.ruleset_iid = rv.ruleset_iid and r.uuid = UUID) )]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:265)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:252)
at org.hibernate.mapping.Property.isValid(Property.java:174)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:325)
at org.hibernate.mapping.RootClass.validate(RootClass.java:188)
at org.hibernate.cfg.Configuration.validate(Configuration.java:839)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1000)
at com.ingenix.freya.util.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:50)
at com.ingenix.freya.enterprise.ejb.EnterpriseServiceImpl.getSession(EnterpriseServiceImpl.java:481)
at com.ingenix.freya.util.ejb.BasePersistenceService.executeHibernateQuery(BasePersistenceService.java:644)
at com.ingenix.freya.enterprise.ejb.EnterpriseServiceImpl.getAllEnterprises(EnterpriseServiceImpl.java:436)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:130)
at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:51)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:139)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
at org.jboss.ejb.Container.invoke(Container.java:873)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:805)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)

Name and version of the database you are using:
SQL Server 2005
The generated SQL (show_sql=true):
No SQL generated yet. Seems to fails while processing associations...
Debug level Hibernate log excerpt:
None.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 10:13 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Obviously that formula is returning more than one row (hence a List). You can't do that. Put in a "top 1", or further restrict the where clause so that the subselect results in only one value.

_________________
Code tags are your friend. Know them and use them.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.