Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9105639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:09:15+00:00 2026-06-17T02:09:15+00:00

I need to find a way that a set of values will always generate

  • 0

I need to find a way that a set of values will always generate the same ID and it needs to be unique.

The main reason for this is to speed up queries where before I needed to do a lot of joins, to only one comparision. I know my domain and sadly the values are not closed (i.e., they can be about anything).

I tryied with hash, but by definition, hash functions don’t guarantee uniquiness. Is there a way?

EDIT: Some more context

I am working in a system that correlate Events coming from different set of devices.

The correlation is calculated through some of the Events attributes:

  • From where it came from.
  • What kind of event it is.
  • Values that come from it and that differs the same kind of events in different groups.

For example, think of something like this. Imagine my device is a refrigerator. It sends events about the temperature and food that are inside of it. So, imagine we receive events in this order:

Event1: {type: temperature, values: [{temperature: -1]}
Event2: {type: food, values: [{group: vegetable, name: brocollis, quantity: 2, weight: 0.1]}
Event3: {type: food, values: [{group: vegetable, name: lettuce, quantity: 1,  weight: 0.1]}
Event4: {type: temperature, values: [{temperature: -5]}

All events of type temperature must be correlated, but of type food the correlation is also given from the its name and group. I.e., the number of correlation identifiers is variable.

This correlations are saved in a structure like this

@Entity
public class EventCorrelation {
    @Id @GeneratedValue
    @Audit
    private Long id;

    @ElementCollection
    @CollectionTable(
       name = "evt_corr_extra_id",
       joinColumns = @JoinColumn(name = "correlation_id"))
    @Column(name = "extra_id")
    @LazyCollection(LazyCollectionOption.TRUE)
    @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
    private Collection<String> identifiers;
    // getters/setters
}

It’s inside the identifiers array that I save the values that identify the correlation. I want to speed up the query that search for an event correlation and my first idea was to create an unique id from the correlation identifiers.

I have a knowledge database that knows that from a given event, certain attribute is a correlation identifier.

Any tips?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T02:09:16+00:00Added an answer on June 17, 2026 at 2:09 am

    One possible solution is to convert your values to Strings and concatenate them using some kind of reserved delimiter, making sure to preserve ordering. The String becomes your unique id.

    For example, the values 1, “Bob”, 7383.234, “{asdf}”, and 2013-01-08 would have the following unique id:

    "1|Bob|7383.234|{asdf}|2013-01-08"
    

    This is a kind of memoization technique.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to find some way of displaying a drop-down menu that depending on
We need to find a sensible way to manage our in-house .NET libraries that
I need to update a datastore entity in a way that will not be
I am using primefaces datatable with clickable rows and I need to find way
I need to find a way to get actual page size in Google Chrome.
I need to find a way to check if the mouse moves in c#,
I need to find a way to spin off a thread from a static
I need to find a way to call a vb.net function in my aspx
I need to find a way to be notified when a System.IO.Pipe.NamedPipeServerStream opened in
I need to find a way to store 250 KB of plain text numbers

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.