Prevent entity from being created, but need entity for native query
I have a native query that executes a stored procedure and the results is mapped to an entity, this works fine but the t开发者_开发技巧hing is the entity is created in the database (I'm referring to the actual table being created, but this table will always be empty), any way to prevent this?
I'm using JPA with hibernate and Sql Server 2005
Thanks
You shouldn't use an entity if it's not supposed to be stored in any database table. The query should return a list of objects which are instances of a class not annotated with @Entity
.
That being said, letting hibernate generate the database schema for you is something you should only do for quick prototyping, at the very beginning of a project. Later, the schema should not be created automatically anymore.
精彩评论