Name attribute in @Entity and @Table

后端 未结 4 1902
一向
一向 2020-12-01 02:30

I have a doubt, because name attribute is there in both @Entity and @Table

For example, I\'m allowed to have same value for name attribute

@Entity(n         


        
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-01 03:12

    @Entity is useful with model classes to denote that this is the entity or table

    @Table is used to provide any specific name to your table if you want to provide any different name

    Note: if you don't use @Table then hibernate consider that @Entity is your table name by default and @Entity must

    @Entity    
    @Table(name = "emp")     
    public class Employee implements java.io.Serializable    
    {
    
    }
    

提交回复
热议问题