ObjectID is my own ID-class
In my mapped Entity-class I have next getter for ID
@Id
@Column(name = "aa_id")
@SequenceGenerator(name = "PatientSequenceGenerator",
sequenceName = "patient_seq")
@GeneratedValue(strategy = GenerationType.SEQUENCE,
generator = "PatientSequenceGenerator")
public ObjectID getId()
{
return id;
}
generator generate Long value, so I got exception
this id generator generates long, integer, short or string
So, do I can add to my getter logic, that will create ObjectID from long, for example
//annotations
public ObjectID getId()
{
//logic that that get Long from sequance
return new ObjectID(gettedLong);
}
You shouldn’t do that. Your ID field should be of one of the listed types or an
@EmbeddedIdor an@IdClass