0

When ever the query is getting generated, Hibernate provides it's own naming conventions, which is getting messy for huge queries,

for Example: select * from user generated_alias0 .....[long query]

do we have any property or way to give our own alias so that it will be easy to track them on the console it self, not in a way like to copy it to another text editor then highlight with help of some tool

What I tried it: To give an alias to root object itself like:

Root<User> userRoot = criteriaQuery.from(User.class);
userRoot.alias("user");

but the query getting generated is still the same:

select * from user generated_alias0 .....

1 Answers1

0

Using createAlias you can handle it . Ref: This Hibernate: Criterion. Add Alias to Criterion Object might be duplicate .

Senthil
  • 2,156
  • 1
  • 14
  • 19