-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: MySQL views and Hibernate Mappings
PostPosted: Thu Jan 07, 2010 1:40 am 
Beginner
Beginner

Joined: Thu May 17, 2007 8:37 am
Posts: 22
Location: London
Hi all,

I can successfully use MySQL views as Hibernate/JPA entities but the application will not deploy unless I disable the model validation upon deploy (hibernate.hbm2ddl.auto = validate).

How can I use Views as Entities and still use the model validation?

Thanks,

Damian.

============ Entity based on View ===========
package com.locuslive.odyssey.entity;

// Generated Jan 7, 2010 5:08:02 PM by Hibernate Tools 3.2.5.Beta

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
* SchedulePortDetailsView generated by hbm2java
*/
@Entity
@Table(name = "SCHEDULE_PORT_DETAILS_VIEW")
public class SchedulePortDetailsView implements java.io.Serializable {

/**
*
*/
private static final long serialVersionUID = -5696573899178977147L;
private long ptListId;
private String locode;
private String name;
private String routeName;
private byte[] voyageNumber;
private String vesselName;
private Date etaDate;
private Date etaTime;
private Date etdDate;
private Date etdTime;

public SchedulePortDetailsView() {
}

public SchedulePortDetailsView(long ptListId, String locode, String name, String routeName, String vesselName) {
this.ptListId = ptListId;
this.locode = locode;
this.name = name;
this.routeName = routeName;
this.vesselName = vesselName;
}

public SchedulePortDetailsView(long ptListId, String locode, String name, String routeName, byte[] voyageNumber, String vesselName, Date etaDate, Date etaTime, Date etdDate, Date etdTime) {
this.ptListId = ptListId;
this.locode = locode;
this.name = name;
this.routeName = routeName;
this.voyageNumber = voyageNumber;
this.vesselName = vesselName;
this.etaDate = etaDate;
this.etaTime = etaTime;
this.etdDate = etdDate;
this.etdTime = etdTime;
}

@Id
@Column(name = "PT_LIST_ID", nullable = false)
public long getPtListId() {
return this.ptListId;
}

public void setPtListId(long ptListId) {
this.ptListId = ptListId;
}

@Column(name = "LOCODE", nullable = false, length = 6)
public String getLocode() {
return this.locode;
}

public void setLocode(String locode) {
this.locode = locode;
}

@Column(name = "NAME", nullable = false, length = 250)
public String getName() {
return this.name;
}

public void setName(String name) {
this.name = name;
}

@Column(name = "ROUTE_NAME", nullable = false, length = 100)
public String getRouteName() {
return this.routeName;
}

public void setRouteName(String routeName) {
this.routeName = routeName;
}

@Column(name = "VOYAGE_NUMBER")
public byte[] getVoyageNumber() {
return this.voyageNumber;
}

public void setVoyageNumber(byte[] voyageNumber) {
this.voyageNumber = voyageNumber;
}

@Column(name = "VESSEL_NAME", nullable = false, length = 150)
public String getVesselName() {
return this.vesselName;
}

public void setVesselName(String vesselName) {
this.vesselName = vesselName;
}

@Temporal(TemporalType.DATE)
@Column(name = "ETA_DATE", length = 0)
public Date getEtaDate() {
return this.etaDate;
}

public void setEtaDate(Date etaDate) {
this.etaDate = etaDate;
}

@Temporal(TemporalType.TIME)
@Column(name = "ETA_TIME", length = 0)
public Date getEtaTime() {
return this.etaTime;
}

public void setEtaTime(Date etaTime) {
this.etaTime = etaTime;
}

@Temporal(TemporalType.DATE)
@Column(name = "ETD_DATE", length = 0)
public Date getEtdDate() {
return this.etdDate;
}

public void setEtdDate(Date etdDate) {
this.etdDate = etdDate;
}

@Temporal(TemporalType.TIME)
@Column(name = "ETD_TIME", length = 0)
public Date getEtdTime() {
return this.etdTime;
}

public void setEtdTime(Date etdTime) {
this.etdTime = etdTime;
}

}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.