Just another site

Hibernate exception: duplicate association path

Hibernate doesn’t provide function to check existing alias. If you try to add the same alias to the criteria, you will get exception: duplicate association path.

The solution is to create a set and record all exisitng alias. We only add new alias if it’s not in the set.

private List<String> aliasValues = new ArrayList<>();

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: