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

  • SEARCH
  • Home
  • 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 8687773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:11:43+00:00 2026-06-12T23:11:43+00:00

Continuing with this I decided to take an approach of making a different entity

  • 0

Continuing with this I decided to take an approach of making a different entity and make a OneToOne relationship (I hope this is OK). Bet let me explain what I have been doing:

I have a Juez (judge) entity with these relevant fields:

@Entity
@Table(name = "jueces")
public class Juez implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.TABLE)
    @Column(name = "id")
    private Integer id;

    @Version
    @Column(name = "opt_lock")
    private Integer version;

    @Basic
    @Column(name = "nombres")
    private String nombres;

    // Getters, setters, other properties, etc.

}

And I want another entity called RolDeJueces (judge roll) to hold a java.util.Map<Integer, Juez> in which I want the keys to be sorted (1,2,3…) and mapped to a judge so I can have a roll to make some calculations. Here is what I have until now:

@Entity
@Table(name = "rol_jueces")
public class RolDeJueces {

     @Id
     private Integer id;

     @Version
     @Column(name = "opt_lock")
     Integer version;

     @OneToMany //Is this ok?
     @MapKeyColumn(name = "orden_juez", updatable = true)
     private Map<Integer, Juez> rol;

     // Getters, setters, other properties, etc.

}

How can I sort the map key and hold a reference to all my judges but only one time (a la @OneToOne)?

Also, I must be capable of reordering my judges and make the changes persistent e.g.

rolDeJueces.getRol().clear(); // Delete current order
int order = 0;
// Add judges according to new order to the roll
for(Juez juez : getNewOrder()){
    RolDeJueces.getRol().put(++order, juez);
}

// save my new roll and stuff...

Is this possible?

  • 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-12T23:11:44+00:00Added an answer on June 12, 2026 at 11:11 pm

    Ok, I figured that I do not need a map for insertion order nor the stuff I wanted.

    Here is the impl:

     @Id
     @GeneratedValue(strategy = GenerationType.TABLE)
     private Integer id;
    
     @Version
     @Column(name = "opt_lock")
     private Integer version;
    
     @OneToMany(orphanRemoval = false)
     @OrderColumn(name = "order_jueces")
     private List<Juez> rol;
    

    @OrderColumn will generate an extra column in the table used for the relationship.

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

Sidebar

Related Questions

Edit: I decided to take the LINQ to XML approach (see the answer below)
Continuing from this question : When I am trying to do fopen on Windows,
I have a list like this: ['Ww','Aa','Bb','Cc','ww','AA','BB','CC'] And continuing in such a pattern, with
I'm trying to figure out the best approach to take in my current situation.
READ FIRST I re-wrote this to make it more readable. If you want to
I am making a search function on a website to let users search values
Reading this question , I've decided I need to use something like this: list<vector<double>
For my first project in flash I decided to make a little football game.
I've been working on this page http://www.btselem.org/hebrew/131606 I decided to add the Facebook Share
Found this Multimap containing pairs? , but it is not much help How would

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.