I tried to give `@Column(name = "message")` only for the field, but it didn't work.

I have a Bean class, that contains 10 fields but i want to insert only 2 fields using HIBERNATE ANNOTATION..?
How can i omit rest of the fields??

I am getting full Query:

```
insert into message (circle, day, destNumber, encryptedBody, hour, interfaceType, location, message) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

```

Instead i want only:
 insert into message (message,msgId) values(?,?)
['https://Stackoverflow.com/questions/19532982', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2888996/']
According to the [documentation](http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch05.html#mapping-declaration-property), you need to annotate the properties that you **don't** want to be persisted as `@Transient`:

```
@Entity
public class Message implements Serializable {

    Long id;
    int circle;
    int day;
    String message
    //...

    @Id
    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }

    // Will not be persisted
    @Transient
    public int getCircle() { return circle; }
    public void setCircle(int circle) { this.circle = circle; }

    // Will not be persisted
    @Transient
    public int getDay() { return day; }
    public void setDay(int day) { this.day = day; }

    // Will be persisted
    public string getMessage() { return message; }
    public void setMessage(String message) { this.message = message; }

    //...
}

```

If you need the `Id` to be auto-generated, you should annotate it with [`@GeneratedValue`](http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch05.html#mapping-declaration-id-generator):

```
    @Id
    @GeneratedValue
    @Column(name = "msgId")
    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }

```

The `@GeneratedValue` annotation has many parameters that help you define how the identifier should be generated. For example, if it will be generated by the database (identity column) you should use `@GeneratedValue(strategy=GenerationType.IDENTITY)`. [This](http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch05.html#d5e2487) section of the documentation lists all of the generation strategies.

Please read the documentation carefully. You'll find the answer to almost all of your questions in the documentation. Refer to the links that I've provided.
For the MsgId issue

1.Make sure that your MsgId field is set to Primary key and auto increment

2.add these annotations for MsgId

> 
> @Id
> 
> 
> @GeneratedValue(strategy=GenerationType.AUTO)
> 
> 
> public Long getMsgId() {
> 
> 
> return id;
> 
> 
> }
> 
> 
>