J'ai un objet qui contient une propriété qui est le résultat d'une instruction SQL. Comment ajouter l'instruction SQL à mon fichier de mappage nHibernate?Utiliser la requête SQL pour remplir la propriété dans le fichier de mappage nHibernate
Exemple Objet:
public class Library{
public int BookCount
{
get;
set;
}
}
Exemple Mapping fichier:
<hibernate-mapping>
<class name="Library" table="Libraries">
<property name="BookCount" type="int"> <- This is where I want the SQL query to populate the value. ->
</class>
</hibernate-mapping>
Exemple de requête SQL:
SELECT COUNT(*) FROM BOOKS WHERE BOOKS.LIBRARY_ID = LIBRARIES.ID