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.  [ 7 posts ] 
Author Message
 Post subject: Silent Error?
PostPosted: Fri Jan 30, 2009 12:03 pm 
Newbie

Joined: Fri Jan 30, 2009 11:47 am
Posts: 5
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 30, 2009 12:48 pm 
Newbie

Joined: Fri Jan 30, 2009 11:47 am
Posts: 5
Hi All - it appears that somehow i wiped out mu msg before i submitted. so here's my msg again:
looking for some help as it appears that i am getting a silent Nhibernate error. I am new to this so please bear with me. I am trying to load the product table from adventureworks on sql server 2005 into a very basic product object in an ASP.NET 3.5 web application running MVC. I get no errors when i run and nothing back from the DB. I enabled logging and here's the only thing i got:
2009-01-30 09:49:58,869 - opened session
2009-01-30 09:50:02,447 - after autocommit
2009-01-30 09:50:02,447 - transaction completion
2009-01-30 09:50:02,447 - transaction completed on session with on_close connection release mode; be sure to close the session to release ADO.Net resources!

Here's my mapping file:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="PMO.Core" namespace="PMO.Core">
<class name="Product" table="Product" schema="Production" optimistic-lock="none">


<id name="ID" column="ProductID" unsaved-value="0">
<generator class="identity" />
</id>


<property name="Name" column="Name" />

<property name="Number" column="ProductNumber" />

<!--
<many-to-one name="Supplier" column="SupplierID"
class="Supplier" />
<many-to-one name="Category" column="CategoryID"
class="Category" />
-->

</class>
</hibernate-mapping>


and here's my config file:

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.connection_string">Integrated Security=SSPI;Initial Catalog=AdventureWorks;Persist Security Info=False;Data Source=AJUBRAN</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>

<property name="connection.release_mode">on_close</property>
<property name="show_sql">true</property>
<mapping assembly="PMO.Core"/>
</session-factory>



</hibernate-configuration>

Please let me know what code you'd like me to post.

Thanks a lot.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 02, 2009 3:18 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Have you set the log level to DEBUG ? And enable SQL output with show_sql="true" in the config.

The code where you load the products would be helpful.

_________________
--Wolfgang


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 02, 2009 11:07 am 
Newbie

Joined: Fri Jan 30, 2009 11:47 am
Posts: 5
yes i have both of these things enabled.

Here's the call:

List<Product> products = new ProductDao().LoadAll();

now the ProductDao class inherets from a generic DAO (ProductDAO : GenericDAO<Product> ) class which does the following:

public List<T> LoadAll() {
ICriteria criteria = Session.CreateCriteria(typeof(T));
return criteria.List<T>() as List<T>;
}

I did some stepping through the code and it appears that the criteria object above is throwing a "Method may only be called on a Type for which Type.IsGenericParameter is true." all over the place.

sounds like a generics issue? Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 02, 2009 12:21 pm 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
I have no idea ... can you post the stacktrace ? Is there a inner exception ?

_________________
--Wolfgang


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 03, 2009 3:04 pm 
Newbie

Joined: Fri Jan 30, 2009 11:47 am
Posts: 5
ok...I switched the call to a simple Session.get(typeof(Product), 1) to see what happens and now i am getting a No persister for: PMO.Core.Product exception. So Nhibernate cant find my mapping files?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 03, 2009 4:40 pm 
Newbie

Joined: Fri Jan 30, 2009 11:47 am
Posts: 5
you got to be kidding me!
Just found out what's been holding me up all along: My mapping file was not configured with a Build Action = Embedded Resource!!
All good now.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.