I have a table that is something like this:
╔════════════╗
║ table_test ║
╠════════════╣
║ id ║
║ type ║
║ message ║
║ param_x ║
║ param_y ║
║ param_z ║
║ result_a ║
║ result_b ║
║ result_c ║
╚════════════╝
So it's a test that have some parameters and have some results. I don't have a table with the parameters because they aren't pre-defined.
So I want to map this to 3 classes: Test, Paramters and Results.
How can I map this in Hibernate? How Could I, for example, Get the Test and have a Parameters object with the database info ?
Patameters and Result will be fields of Test class.
Use an entity class (Test) and two embedded object classes (Parameters and Results), as described in the Hibernate documentation
@Entity
public class Test
@Embedded
private Parameters parameters;
@Embedded
private Results results;
}
@Embeddable
public class Parameters {
...
}
@Embeddable
public class Results {
...
}