Following a recent question, I would like to add an int column to a table without adding an int member to the class. This will only be used when loading/saving mass-scale instances. We don’t want this int in memory.
Given a MyClass entity – how can I add a MyIntColumn to its table?
Notes:
– Hibernate 3.6.0 Final + Oracle 11g + Java pure
– Using annotations
Thanks,
– 10 of a Kind
If you want to let hibernate create your schema you’d have to create a class member. What you can do is run a direct SQL query (not via HQL) that will alter your table and add the desired column. The problem here is that hibernate won’t be able to use this column unless you define a class member for it – so unless you are going to use direct SQL or let Oracle manage this column (by default values, triggers etc.) you cannot do much with this column.