Reputation: 1126
I am trying to create a Spring Roo entity for a legacy database table. The table does not have a primary key defined.
However, Roo will not let me define an entity without an identifierField
:
@RooEntity(identifierColumn = "", identifierField = "", table = "XYZ", versionField = "")
This causes the Roo integration tests to fail with:
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'id' in 'field list'
Because it creates an @Id
and @Column(name = "id")
field in Roo_Entity.aj.
I have tried reverse engineering this table with Roo's DBRE function, but all it does is create an identifier class containing all of the fields of the entity. When this happens I cannot add finders for the individual table columns.
Upvotes: 0
Views: 1966
Reputation: 85526
As far as I know Roo requires a primary key and strongly suggests a version identifier.
It's possible to use either a simple or a combined primary key. Also looking at DBRE documentation, there is no mention about tables without primary key.
What about fixing the DB? Which DBMS is it? Is it feasible to add a numeric identifier, possibly auto-generated?
Upvotes: 2