java - Get Hibernate Entity instance from id column in SQLQuery result -
I have non-hibernate database tables that have IDs for hibernate entities ( I want to do this in one step, and I think I can do it with the It complains about the missing columns: I think you want something like this: Hibernate, "{entity. *}" Will expand, which will be the column related to entity_table. However, if you have an ID already, you can only use the session. Load () them to convert them to real examples (well, lazy-load proxy). createSQLQuery > addEntity , but I'm not sure how to be right (being hibernate Documentation web site is below. Again.) I can use the addEntity when all columns of the entity table are present, but I only have the ID.
return (list & gt; menu & gt;) session.createSQLQuery (select from "from_selected unit, where Foreign_key_en =? ") .addEntity (" entity_id ", MyEntity.class) .setLong (0, foreigner) .list ();
Session.createSQLQuery ("select {entity. *} To entity_table {entity} ou ....") .addEntity ("entity", Entity.class). (Bind parameter) .list ();
Comments
Post a Comment