I have @Entity that maps to a view, this is how it looks
import org.hibernate.annotations.Immutable; import javax.persistence.*; @Table(name = "user_earning") @Entity @Immutable public class UserFlightEarning { @Id public Long userId; public Long flightId; @Column(name = "flight_seq") public Long flightSequence; }
This works fine, I can extract records from the view using dao. However, I noticed in the logs that Hibernate is actually trying to create a table, but does not work because it already exists.
2015-11-12 21: 56: 34.841 ERROR 4204 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport: HHH000389: Failed: create table user_profile (user_id bigint is not null, avg_airtime integer, avg_fuel_points integer , avg_miles integer, email varchar (255), first_name varchar (255), flights_count integer, furthest_flight integer, last_name varchar (255), longest_flight integer, most_visited_city varchar (255), tier_end integer, tier_start integer 2015, primary -11-12 21: 56: 34.841 ERROR 4204 --- [ost-startStop-1] org.hibernate.tool.hbm2ddl.SchemaExport: Table 'user_profile' already exists
Can I configure hibernation to skip the creation of such objects? I thought the @Immutable annotation tells Hibernate to skip creation, but it seems that this annotation is only to prevent crud operations on the table.
spring spring-data hibernate jpa
prettyvoid
source share