0

Is it possible to use non-existing property in Hibernate xml mapping?

<property name="nonExisting" type="java.lang.String" column="nonExisting"/>

So I can have nonExisting column in my DB, but not in my class. I also need to use Hibernate criteria with that column.

Neil Stockton
  • 11,383
  • 3
  • 34
  • 29
karolkpl
  • 2,189
  • 10
  • 39
  • 60

1 Answers1

0

you can write named query in xml file:

EXP:

<sql-query name="named.query" >
    <return alias="b" class="com.classes.ClassName"/>

select col1 as {b.p1},col2 as {b.p2}
from db_table_name tab where tab.nonExisting = xxxxx

</sql-query>

p1 and p2 variable in your class. col1 and col2 column in your table.

renis
  • 171
  • 7
  • 16