-->
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.  [ 3 posts ] 
Author Message
 Post subject: hibernate tool generated oracle view Map error
PostPosted: Fri Aug 22, 2008 9:37 pm 
Newbie

Joined: Fri Aug 22, 2008 9:23 pm
Posts: 1
Below is a view in oracle10g:

CREATE OR REPLACE VIEW VW_TEST AS
SELECT 'nothing' as nothing,'test' as test
from dual ;

I use hibernate tools to generate JOPO,and get these:
VwTestId.java:

// Generated 2008-8-23 9:30:19 by Hibernate Tools 3.2.0.CR1

import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
* VwTestId generated by hbm2java
*/
@Embeddable
public class VwTestId implements java.io.Serializable {

private String nothing;
private String test;

public VwTestId() {
}

public VwTestId(String nothing, String test) {
this.nothing = nothing;
this.test = test;
}

@Column(name = "NOTHING", length = 7)
public String getNothing() {
return this.nothing;
}

public void setNothing(String nothing) {
this.nothing = nothing;
}

@Column(name = "TEST", length = 4)
public String getTest() {
return this.test;
}

public void setTest(String test) {
this.test = test;
}

public boolean equals(Object other) {
if ((this == other))
return true;
if ((other == null))
return false;
if (!(other instanceof VwTestId))
return false;
VwTestId castOther = (VwTestId) other;

return ((this.getNothing() == castOther.getNothing()) || (this
.getNothing() != null
&& castOther.getNothing() != null && this.getNothing().equals(
castOther.getNothing())))
&& ((this.getTest() == castOther.getTest()) || (this.getTest() != null
&& castOther.getTest() != null && this.getTest()
.equals(castOther.getTest())));
}

public int hashCode() {
int result = 17;

result = 37 * result
+ (getNothing() == null ? 0 : this.getNothing().hashCode());
result = 37 * result
+ (getTest() == null ? 0 : this.getTest().hashCode());
return result;
}

}


VwTest.java

// Generated 2008-8-23 9:30:19 by Hibernate Tools 3.2.0.CR1

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
* VwTest generated by hbm2java
*/
@Entity
@Table(name = "VW_TEST", schema = "BMAP")
public class VwTest implements java.io.Serializable {

private VwTestId id;

public VwTest() {
}

public VwTest(VwTestId id) {
this.id = id;
}

@EmbeddedId
@AttributeOverrides( {
@AttributeOverride(name = "nothing", column = @Column(name = "NOTHING", length = 7)),
@AttributeOverride(name = "test", column = @Column(name = "TEST", length = 4)) })
public VwTestId getId() {
return this.id;
}

public void setId(VwTestId id) {
this.id = id;
}

}


when i ran my application,i got these errors:

...
Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: Missing table: VW_TEST
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:720)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
at org.jboss.seam.persistence.EntityManagerFactory.createEntityManagerFactory(EntityManagerFactory.java:85)
at org.jboss.seam.persistence.EntityManagerFactory.startup(EntityManagerFactory.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
at org.jboss.seam.Component.callComponentMethod(Component.java:2100)
at org.jboss.seam.Component.callCreateMethod(Component.java:2015)
at org.jboss.seam.Component.newInstance(Component.java:1976)
... 140 more
Caused by: org.hibernate.HibernateException: Missing table: VW_TEST
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1080)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:116)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:317)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713)
... 153 more


so what happens? How can i correct these error? thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 25, 2008 4:29 am 
Newbie

Joined: Mon Aug 25, 2008 4:13 am
Posts: 2
I have similar problem, but instead of oracle i use mysql .. I've created db view "used_license" and used seam to generate entity for it, but when i start JBoss AS i receive message:

Code:
10:08:14,601 INFO  [DatabaseMetadata] table not found: used_license
10:08:14,605 WARN  [ServiceController] Problem starting service persistence.units:ear=licence_ev.ear,unitName=licence_ev
javax.persistence.PersistenceException: org.hibernate.HibernateException: Missing table: used_license
   at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:720)
...


Is it possible to create entity for db view anyway?? I can't find nothing about it in doc or in google and i've been searching for a two weeks.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 19, 2008 5:16 am 
Newbie

Joined: Fri Sep 19, 2008 5:06 am
Posts: 1
Hi,

I have exactly the same problem. Entities of tables gets generated and views of the same schema run into this exception:


Code:
javax.persistence.PersistenceException: org.hibernate.HibernateException: Missing table: V_TEST



As database I use Oracle 10g.

It would be helpful to understand if views are supported in general.


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

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.