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 1024367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:46:06+00:00 2026-05-16T11:46:06+00:00

I know this question has been asked before but I have a design question

  • 0

I know this question has been asked before but I have a design question as well.

There are two tables like so:

Table Group_table
column pk_Group_name
column group_type
etc

Table Group_members
column fk_group_name -> foreign key to group_table
column group_member

It’s easy to work with this structure but I have two questions. First, how should I map group_members in Hibernate mapping? Hibernate wants an id of some sort and I’m not sure what to tell it.

Second, although perhaps I should ask it first, is this bad db design? Should there be a pk on the group_members table, like a sequence or something?

Also, this is an Oracle db: is there some autogenerated id I can use despite the (possibly) poor db design?

  • 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-05-16T11:46:06+00:00Added an answer on May 16, 2026 at 11:46 am

    You absolutely need an identifier in the mapping that describes how a row is unique: by PK, assigned, or composite. In your case, you could maybe use a composite-id:

    <class name="eg.Foo" table"FOOS">
        <composite-id name="compId" class="eg.FooCompositeID">
            <key-property name="string"/>
            <key-property name="short"/>
        </composite-id>
        <property name="name"/>
        ....
    </class>
    

    Of course, this assumes the couple (fk_group_name, group_member) is unique. But this is not ideal, you should have a PK.

    Reference

    • 8.4. Components as composite identifiers
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this question has been asked before, but I ran into a problem.
I know this specific question has been asked before , but I am not
I know this question has been asked a bit before. But looking around I
This question has been discussed in two blog posts ( http://dow.ngra.de/2008/10/27/when-systemcurrenttimemillis-is-too-slow/ , http://dow.ngra.de/2008/10/28/what-do-we-really-know-about-non-blocking-concurrency-in-java/ ),
I know this questions has come up in various guises before, but this is
I know this question isn't directly programming related, but since I want to be
I know this question might sound a little cheesy but this is the first
I know this is similar to this question , but I'm using SQL Server
Warning - I am very new to NHibernate. I know this question seems simple
I know about this question: Which (third-party) debug visualizers for Visual Studio 2005/2008 do

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.