from Package p where p.Id = 2
On Wed, Feb 18, 2009 at 11:21 AM, Johannes Gustafsson <[email protected]>wrote:
>
> Hello,
>
> Lets say i have this class:
>
> public class Package
> {
> public virtual int Id { get; set; }
> public virtual PackageStatus Status { get; set; }
> }
>
> and this mapping:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-
> lazy="true" assembly="InExchange.Domain"
> namespace="InExchange.Domain">
> <class name="Package" table="ib_Package">
> <id name="Id" column="PackageId">
> <generator class="native"></generator>
> </id>
> <property name="Status" column="PackageStatusId"></property>
> </class>
> </hibernate-mapping>
>
> The key issue here is that the property names in the entity differ
> from the column names in the table.
>
> If I then enter this HQL: "from Package where Id = 2".
>
> I would expect it to translate to this sql: "select ... from
> ib_Package where PackageId = 2".
>
> Unfortunaly it doesn't. Instead I get this sql: "select ... from
> ib_Package where Id = 2".
>
> It looks to me that the columns in the where clause is not processed
> at all but are just passed through to an sql where clause. In fact, I
> can enter any columnname I like and NH won't complain until I get an
> SqlException.
>
> Anyone else has this behavour?
>
> Regards,
> Johannes
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---