hibernate - NHibernate: How to exclude a class which is part of a join using the Criteria API -


I'm still new to hibernate and I'm trying to use it for a legacy web site . Unfortunately, this means that sometimes DB schemas do not always understand.

With this, I am trying to create the following HQL query using the Benchmark API

  from TableB B where b.id =: id and b TableAroperty.UserId =: userId  

The above HQL statement generates SQL which will only select the tabback and return what I have to do. However, using the Quetta API details shown below, the selected SQL statement selects the field for table and table.

  DataProvider.Session .CreateCriteria & lt; TableB & gt; () .Add (Expression.Eq ("Id", ID)) .Create Cerataria ("Table A"). Add (Expression One ("UserID", User ID)). Unicrus result & lt; Tableb & gt; ();  

In a whole world, I can update the DB schema to understand more, but alas I can not.

Your question does not show the sections associated with the table and TableB, so I'm assuming that the classes There are tables and tablebays and there is a property named TableE in the table tab.

  DataProvider.Session .CreateCriteria & lt; TableB & gt; (). Add (Expression Eq ("id", id)). CreteAlways ("Table A", "A"). Add (Expression One ("a.UserId", User ID)). Unicrus Retail and Lieutenant; Tableb & gt; ();  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -