I have to write an application in Java EE6. I have been given a MySQL database, to which I am not allowed to make any changes. The database is well structured and normalized, but does not have any foreign keys defined to enforce integrity. (It uses the MyISAM engine).
Is it possible to define relationships (using @JoinColumn, @ManyToOne etc.) in JPA Entity classes without defining foreign keys in the database?
Foreign keys are used to check and enforce referential integrity, not to join tables.
In other words, using MyISAM tables doesn’t prevent tables from having relationships between them.
As long as such relations exist (independently of having FK to enforce integrity for them), you can use them to map your entities.