brmeyer / HibernateOSGi

14 stars 11 forks source link

Fail to insert a new record if doesn't use @GenerateValues #8

Closed tocsleung closed 11 years ago

tocsleung commented 11 years ago

I just want to enter id by myself as the other input fields for the persistence object.

So I change the source a little bit and remove @GenerateValue annotation.

@Entity public class DataPoint { @Id // @GeneratedValue private long id;

When I fire the command as below:

dp:add For example, dp:add 1 foo

NO record can be saved into the database.

dp:getAll cannot get anything.

I suspect it is a Hibernate bug on Version 4.2.1-SNAPSHOT

Tom

brmeyer commented 11 years ago

Tom, there's no bug with Hibernate. The "add" CommandAction (a Karaf concept) I have setup for dp:add only takes a name -- not an ID. It's not saved because the action is not expecting 2 arguments and fails.

brmeyer commented 11 years ago

Keep in mind that this repo is just a small demonstration. By no means is it some sort of exhaustive set of capabilities.