Reputation: 84724
I have two tables that are considered a single entity in my domain model.
I join them in my IAutoMappingOverride by calling IgnoreProperty on the properties of the joined table and then using Join with a Map for each of the properties.
This configuration works, but I'm lost at attempting a filter on the columns of the joined table. If I call the following:
Session.CreateCriteria<PrimaryEntity>()
.CreateCriteria("ExtraPropertiesTable", JoinType.InnerJoin)
.Add(Expression.Eq("Language", language)) // Column on ExtraPropertiesTable
.List(primaryEntitiesList);
I get the following exception:
QueryException: could not resolve property: ExtraPropertiesTable of: PrimaryEntity
I have also tried DetachedCriteria to no avail.
Any ideas?
Upvotes: 0
Views: 268
Reputation: 195
If both tables are mapped to the same entity, you shouldn't have to do a join in the hibernate query, you should only refer to the entity, and hibernate will generate the join in the SQL query it generates. Also, the CreateCriteria method expect the name of a mapped entity, not a table.
Upvotes: 1