Yes, you can do that. You just need to make it clear for hibernate which one is the mapping that it’s supposed to maintain, like so:
@Column(name="message_key", updatable=false, insertable=false)
private Long message_fk;
More Related Contents:
- What is the “owning side” in an ORM mapping?
- How do you map a “Map” in hibernate using annotations?
- How to force Hibernate to return dates as java.util.Date instead of Timestamp?
- Why should anybody put annotations on the getters or setters when using JPA to map the classes?
- Hibernate Issue : Foreign key must have same number of columns as referenced primary key
- JPA Map mapping
- Mapping PostgreSQL JSON column to a Hibernate entity property
- Hibernate: different object with the same identifier value was already associated with the session [duplicate]
- Foreign key constraints in Android using SQLite? on Delete cascade
- proper hibernate annotation for byte[]
- Hibernate, @SequenceGenerator and allocationSize
- How to map a PostgreSQL array with Hibernate
- JPA/Hibernate Native Queries do not recognize Parameters
- Error : java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.(I)V
- Found shared references to a collection org.hibernate.HibernateException
- java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
- Hibernate/JPA DB Schema Generation Best Practices
- Spring hibernate template when to use and why?
- Is it possible to detach Hibernate entity, so that changes to object are not automatically saved to database?
- javax.validation.ValidationException: HV000183: Unable to load ‘javax.el.ExpressionFactory’
- Spring + Hibernate : a different object with the same identifier value was already associated with the session
- When and how to use hibernate second level cache?
- Batch inserts with JPA/EJB3
- How do you enforce foreign key constraints in SQLite through Java?
- Spring Controller to handle all requests not matched by other Controllers
- HQL – row identifier for pagination
- Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
- Hibernate using JPA (annotated Entities) and liquibase
- HQL recursion, how do I do this?
- Getting Hibernate and SQL Server to play nice with VARCHAR and NVARCHAR