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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:51:20+00:00 2026-05-26T09:51:20+00:00

I am working with a project where I need to store a object in

  • 0

I am working with a project where I need to store a object in hibernate and it consist of many user defined objects. I know how use hibernate mapping with a object that only contain “ususal” types(int, String, etc…) but with custom types I’ve seen suggestions such as usage of the annotation @embedded and implementing UserType but I haven’t seen any suggestion on how to simply map the objects inside the object to a certain table. Note: these objects aren’t going in the same table, just in the same db. What I want to do is have a mapping that allows this function in my DaoImplementation:

public void store(MyObject o){
hibernateTemplate.saveOrUpdate(o);
}

This is soft of how my object looks:

public class MyObject{

private String name;

private ObjectA type;//Contains an int

private ObjectC look;//Contains a String.

private ObjectB[] children;//contains a string and other children.

public MyObject(){}

//Getters and setters omitted.

}

public class ObjectB{
private String name;
private ObjectB[] children;

public ObjectB(){}
//Getters setters omitted
}
  • 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-26T09:51:21+00:00Added an answer on May 26, 2026 at 9:51 am

    If the contents of some object needs to be stored in a separate table, then this object should be another persistent entity, and you should use associations between entities : OneToMany, ManyToOne, OneToOne, ManyToMany, depending on the cardinalities.

    Read the hibernate reference manual.

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

Sidebar

Related Questions

I am working on a project and I need to save user configuration. The
In a project I'm working on, I have an object that is a sort
I'm working on a project where I need to use some hash function to
For a project I'm currently working on I need to implement object versioning. Unfortunately
I have a Crystal Reports project that I am working on where I need
I'm currently working on a project that's based on Android. Without getting into many
I'm working with C++ for a project. I need to store a pair (string,integer)
I am working a project where I need to generate a series of classes
I'm working on a project were we need more performance. Over time we've continued
I'm working on a project where I need the following. WCF service on the

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.