How to map a column that does not exist in the bank?

Asked

Viewed 166 times

3

I have a small problem when mapping (JPA) the columns of a class of my system. I have some procedures in bank that do a lot of things already and would not like to stop using them, but I do not know how to map.

SELECT r.*, ultimo_documento(r.id) as ultimo, ultima_acao(r.id) as ultima,
abcd(r.id, r.nome) as campo_teste
FROM requerimento

I have in my class the fields 'ultimo, ultima, campo_teste' mapped with @Transient. But these fields are not filled in. Utilise @NativeQueries declared before the entity.

How to map a column that does not exist in the database?

  • 1

    What do you mean, friend? Do you need to have this information persisted in the bank? If you already have @Transient, I see no problems with implementation unless the compiler accuses something.

1 answer

0

query.addScalar("campo_teste", StringType.INSTANCE); // Ou seja lá qual for o tipo
query.list();

?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.