gustavo sanchez

Greenhorn
+ Follow
since May 18, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by gustavo sanchez

I need to disable the creation of foreign keys when <property name="hbm2ddl.auto">update</property> is set, cause when i delete the FK and aplication restart, hibernate create all the FK again.
When i was using MySql, hibernate does not create the FK contraints, but when i switch to Microsoft SQL server, it create the constraints but i need to delete it cause im inserting data with PK of other database
Im having the same problem, when i see the stack of tcp connections from tomcat to hibernate, all the connections are in "close wait" state.
I cant figure the reason, i hope someone can help !
thanks, it sounds good, but is not working, now, hibernate traslate the query in that way :
".....dress2_.id and (. in (? , ? , ? , ? , ? , ?
, ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ?))"

the field is called by hibernate ".", and i send to hibernate in hql :
"from Person act where act.addresses in (:V0)"

the traslated query, must have the pivot table (many to many).... but i dont know how to tell to hql "thats a collection of Addresses, you must use pivot table"
[ May 21, 2007: Message edited by: gustavo sanchez ]
I'm trying to filter using an array of objects, because sometimes is many to many or one to many the kind of object that i need to filter. I'm using the flowing code :

...getSession().createQuery("from Person where addresses in ( :L0)");
qry.setParameterList("L0", (Collection)val);

val is an arrayList... of Objects "Address"

and hibernate create that query:

Hibernate: select person0_.id as id21_, person0_1_.customerId as customerId21_, person0_.documentNumber as document2_26_, person0_.firstName as firstName26_, person0_.lastName as lastName26_, person0_.email as email26_, person0_.companyId as companyI
d26_ from persons person0_ inner join contacts person0_1_ on person0_.id=person0_1_.id, contact_addresses addresses1_, addresses address2_ where person0_.id=addresses1_.contactId and addresses1_.addressId=address2_.id and ({non-qualified-property-ref
} in (? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ?))

the query contains an {non-qualified-property-ref} ... but the mapping appear to be ok, i dont know what kind of error im having in that code or mapping

thats the involved part of the mapping file

<class name="Contact" table="contacts" abstract="true" polymorphism="explicit">
<id name="id" type="long">
<generator class="native"/>
</id>
<set name="addresses" table="contact_addresses" cascade="all">
<key column="contactId"/>
<many-to-many column="addressId" class="Address"/>
</set>
.....
<joined-subclass name="Person" table="persons">
<key column="id"/>
<property name="documentNumber"/>
<property name="firstName"/>
<property name="lastName"/>
<property name="email"/>
<many-to-one name="company" column="companyId"/>
</joined-subclass>
</class>

<class name="Address" table="addresses">
<id name="id" >
<generator class="native"/>
</id>
....
<property name="city"/>
....
</class>


then, i got a exception....

11:00:09,625 WARN JDBCExceptionReporter:77 - SQL Error: 0, SQLState: 07001
11:00:09,640 ERROR JDBCExceptionReporter:78 - No value specified for parameter 1
11:00:09,656 WARN RequestProcessor:528 - Unhandled Exception thrown: class org.hibernate.exception.SQLGrammarException
11:00:09,687 ERROR [action]:250 - Servlet.service() para servlet action lanz� excepci�n
java.sql.SQLException: No value specified for parameter 1

I hope that to be posible to do in hibernate, but im not sure how to do that... if someone know, it will appreciate the help
[ May 18, 2007: Message edited by: gustavo sanchez ]