473,414 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

NHibernate: Session.Find throws Unique Index Exception -> but Finding should be Readonly!

Hi folks,

I am net to NHibernate, and I hava a read baisc/general question.

In my database (PostgreSQL), I have an unique index laying on the field
transaktionsnummer which is located in the table payment.

I use the Find-Method of the Session class to query some objects:

ArrayList find = (ArrayList)Program.Session.Find("from payment where
transaktionsnummer = ? ", transaktionsnummer, NHibernateUtil.Int32);

What now happens amazes me : I get an Db-Exception "duplicate key
violates unique constraint uind_transaktionsnummer"

So my general question is: the Find-Method should be Read-Only,
shouldn't it? How can a querying function trhow a uniqe constraint
exception? It isn't supposed to write someting, or am I completely
wrong?

thanks for any Hints,

Bernd

Nov 28 '06 #1
1 3501
<bl*******@gmx.netwrote:
I am net to NHibernate, and I hava a read baisc/general question.

In my database (PostgreSQL), I have an unique index laying on the field
transaktionsnummer which is located in the table payment.

I use the Find-Method of the Session class to query some objects:

ArrayList find = (ArrayList)Program.Session.Find("from payment where
transaktionsnummer = ? ", transaktionsnummer, NHibernateUtil.Int32);

What now happens amazes me : I get an Db-Exception "duplicate key
violates unique constraint uind_transaktionsnummer"

So my general question is: the Find-Method should be Read-Only,
shouldn't it? How can a querying function trhow a uniqe constraint
exception? It isn't supposed to write someting, or am I completely
wrong?
I suggest you turn on appropriate logging in NHibernate or Postgres to
see what SQL is being generated. That should make it clearer what's
going on.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nov 28 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Borek | last post by:
In my project I have to access in one business method of session bean usually more then 10 CMP Beans. I would like to have some utils classes, which could get me right instance of CMP or create...
8
by: Roman | last post by:
Hello i got this simple problem using nhibernate. I want to chang the id( primary key of the) object and update it, to change this key. i me getting nhibernate exception like this: identifier...
0
by: Aquila Deus | last post by:
The documents on their website are completely wrong. Following is the a real example that works with NHibernate 1.0.2.0: <?xml version="1.0" encoding="utf-8"?> <configuration...
1
by: erin.sebastian | last post by:
Hello All, I am new to hibernate and new to nHibernate. I created a small app and when i try and run it i get the error i posted at the bottom of this message. I am using the helper class that...
4
by: Abi | last post by:
We able to generate this error in our test environment and were able to research this enough to understand that the issue is NOT with an abject that needs to be serialized but rather as the stack...
0
by: TigrouMeow | last post by:
Hello, I'm trying to make a "clean" webservice, using Nhibernate. I'm facing some issues, but i'm quite the beginner with that kind of system. When there are more than 2 clients connected on my...
0
by: Pieter | last post by:
Hi, I'm using NHibernate 1.2 (CR1), and I'm using a custom list (inherited from BindingList(Of T) ) for all my lists. The NHibernate documentation told me that I had to implement...
4
by: IceMan | last post by:
Hi, I am using the configuration object and passing it a Assembly object to load. The assembly object i pass in is from a dll which is in a different folder then the Nhibernate dll. The...
0
by: tgadiche | last post by:
Hi, I have a database table called RackLocation which has a column called"isDrop" which is of type boolean. I'm trying to extract all those records from this table whose"isDrop" property is true. ...
7
by: Virendra Maloo | last post by:
I have developed an (PHP)application which has been tested on different development servers. So when I login to the app and navigate to a specific page just after loggin-in, the app logs-out and I...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.