Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

453
Vistas
How to create a JPA entity for a table that doesn't have a Primary Key or Unique Key column

l have a table without a Primary Key or Unique Key column. I need to manipulate this table from the Spring application by using JPA and Hibernate.

While I was trying to map this table’s entity, it fails because there's no @Id mapping.

I tried to make a composite id from all the entity properties to ensure uniqueness, but in this case, the entity has returned an immutable object.

I need to manipulate some variables of this entity. What should I do? To alter the table by adding a unique column will bring me new challanges. Is there a way without altering table?

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Let's assume you wanted to change those records with SQL. How would you know which row to update or delete if you don't have a unique column?

Unless you create a unique column, there's nothing you can do about it.

over 4 years ago · Santiago Trujillo Denunciar

0

There should be a unique way to identify your records. Sometimes, you have multiple columns. In this case, you use a composed primary key. In JPA, you can implement a composed primary key in two ways: @EmbeddedId or @IdClass.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda