Select Categories Below
Advertisement
Start Your Own Q&A Site
Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.
Status: Closed Points: 200 Time: 08:16 - Sep 29, 2008
dustPuppy
Hi, I am getting this error after I added a formula to a class: Value cannot be null. Parameter name: fieldName The formula is: <property name="AnswersCount" formula="(SELECT COUNT(A.postid) FROM Answerpost as A WHERE A.Userid = id)" insert="false" type="Int32" /> I suppose that it's because the formula returns null, but I can't find a way to get around it. I'd appreciate any help or directions...
Categories:
Add Categories
When adding more than one category, separate them with commas.
nidhi
Date:: Sep 29, 2008
Time:: 18:31
Im currently using Hibernate with Spring in Java. Now I know you are using asp.net but the basic concepts should be the same. The hibernate queries I use reference a class, and we have hibernate mapping (xml) files that map variables inside a class to a column in the table It looks like you got normal sql, I wonder if you need to use it as Hibernate expects? I do not use formula's like you do as Ive coded it with the class querying. XML files simply used to map (*.hbm.xml)
Date:: Sep 30, 2008
Time:: 05:41
Hi Nidhi, As far as I've read formulas have to be sql, hql won't work there. But I figured out what the problem was. In this particular case I had created a sql query instead of using the hql, in order to get a particular result set of the user class that this formula is part of. So the sql was not adding the AnswersCount "virtual" property and that was why it was giving an error.
abcpaem
Date:: Nov 28, 2009
Time:: 03:55
Hi there, I have the same problem but I don't see a clear answer for the reason of this error, so after googling a little more, I found that the error occurs because you have the formula attribute set on any of the properties in the mapping file, so it looks as if nhibernate ignores the formula when you use CreateSqlQuery but then tries to access the derived column from the result set which creates the error. This seems to be a bug in Nhibernate and I haven't found a workaround. To avoid this error, as dustyPuppy said, you must try to use a normal CreateQuery instead of CreateSQLQuery or remove the properties with the formula attribute in your mapping file, as there is not currently a patch for this issue.
Question Answered
This question has been closed, and points have been rewarded to the following experts:
You're welcome however to comment or give additional information or if you wish, you have the ability to write a Tutorial in the Tutorial Area.
Answer this Question
New User
Email:
Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address
Registered User
Username:
Password:
Forgot Your Password?
Enter your email address below and we will resend your login information to you.
Login Information Sent
Questions
whats the best food to eat during midnight?
How to identify the tiffany jewelry? www.tffanycheapmall.com.
Send an email alert to each user of the php application based on criteria
How I Increased My AdSense Earnings?
how to choose the lady dress ?
How can I fulfill the minimum requirement to make your computer support 3D?
You have 100 characters to use
Rank
Expert
Points
1.
10354
2.
6493
3.
5596
4.
4848
5.
3487
6.
2840
7.
2770
8.
2303
9.
1820
10.
917
Register today to share your knowledge with the community and be recognized and rewarded for your contributions.
Register Here
"Psst, Quomon is a great site. Pass it on." Tell a Friend | Link To Us | Save to Delicious | Digg it
Language Options
English:
Español:
Sponsors
Questions and Answers Software