I use spring web flow 2 with hibernate annotations. I have a question that may sound stupid but I have to ask it: is there possible that in my jsp using form tags to bind a whole class? I am asking this, because when I generated my entity classes from SQL Server 2008 using Intellij it autogenerated also my @ManyToOne
column (it's about 2 tables: one named Leader
-with idLeader
,name
..and so on and another named Phd
in wich i have idLeader
refered.
When I generated my tables with hibernate annotations, in my Phd
class intellij put also my @ManyToOne
columnm (PhdEntity
has now beside the idLeader
property, another one refering to Leader
class with getter and setter). All was good until I tried to run my application and gaved me the error that i must put insertable = false, updatable = false
at idLeader
column.
Having that done, my application worked perfectly until I had to insert the referenced column idLeader wich doesn't work because I have the insertable = false, updatable = false
. In that case it is rationable to insert the class Leader instead of the id(beacause I have the column generated). So in my jsp i have all the ${leaders}
in a form:select
with the path='Leader'
but I can't fix this because it gives me the error that it can't bind String
to Leader.class
(even if i add a PropertyEditorRegistrar
: propertyEditorRegistry.registerCustomEditor(Leader Entity.class,new ClassEditor())
;
It is possible to bind a whole Leader.class
or I have to delete that autogenerated column and let only my idLeader in PhdEntity
class?