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/']
> 
> Use Dynamic insert or dynamic-update
> 
> 
> 

The dynamic-insert attribute tells Hibernate whether to include null properties in the SQL INSERT statement.

To update only modified values Use dynamic-update option 

If dynamic-update set to true, then hibernate excludes unmodified properties in the Hibernate’s SQL update statement. 

> 
> @Entity
> 
> 
> @Table(name = "table")
> 
> 
> @org.hibernate.annotations.Entity(
>  dynamicUpdate = true)
> 
> 
> public class Sample implements java.io.Serializable { // } 
> 
> 
> 

[Example for dynamic insert](http://www.mkyong.com/hibernate/hibernate-dynamic-insert-attribute-example/)

[Example for dynamic update](http://www.mkyong.com/hibernate/hibernate-dynamic-update-attribute-example/)
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;
> 
> 
> }
> 
> 
>