-->
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: Problem trying to get table to map
PostPosted: Thu May 12, 2005 9:32 pm 
Newbie

Joined: Thu May 12, 2005 7:48 pm
Posts: 1
I am getting the following problem when I try to map the FAC table in my database:


17:08:02,939 ERROR PARSER:35 - *** ERROR: FAC is not mapped.

I'm using hibernate 3.0.3:

The primary key is the column FAC_SK which is a numeric sql type. I think that means it
maps to a Java type of BigDecimal. I noticed in the docs that hibernate maps to a long, short, int or a string. To do a
simple pull of data I've attempted to use another column with a String type. The use of the String did not work. Can I map this table using a Numeric sql type or do I need to use some other method? The database I am using is Sybase. The version of Sybase is ASE 12.5



Any help would be greatly appreciated.



My Mapping file is as follows:

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name=Site"
table="FAC">
<id name="id"
type="string"
unsaved-value="null">
<column name="FAC_NAME"
sql-type="string"
not-null="true"/>
<generator class="uuid.hex"/>
</id>

<property name="BeNumber" column = "BE_NUMBER" type="string"/>

<property name="PrimaryFunctionType" column = "CATEGORY" type="string"/>

<property name="CategoryCode" column = "CC" type="string"/>


<property name="status" column = "OPER_STATUS"/>


<property name="OSuffix" column = "OSUFFIX" type="string"/>


<property name="RepairTime" column = "REVIEW_DATE" type="string" />


<bag name = "tracks" cascade="delete">
<key column = "EQP_NAME"/>
<one-to-many class = "Device"/>
</bag>
</class>


<class name = "Device" table = "EQP">
<id name = "id" >
<generator class="uuid.hex"/>
</id>

</class>
</hibernate-mapping>



My Source Code for the mapping class is here:




package mil.af.lackland.ewme.ontology;
/*
* Site.java
*
* Created on October 22, 2003, 3:18 PM
*/
import java.io.Serializable;
import java.util.List;
import java.util.Vector;
import java.math.BigDecimal;
import javax.sql.rowset.serial.SerialBlob;
import java.sql.Blob;

/**
*
* @author bh0841
*/
public class Site extends Space implements Serializable {
private String categoryCode = null;
private String beNumber = null;
private String oSuffix = null;
private String primaryFunctionType = null;
private String status = null;
private String repairTime = null;
private Location siteAssociatedLocation = null;
private Country siteAssociatedCountry = null;
private Vector siteAssociatedDevices = null;
private java.util.List track = null;
private String id;


/** Creates a new instance of Site */
public Site(String siteName, String categoryCode, String beNumber,
String oSuffix, String primaryFunctionType, String status,
String repairTime, Location siteAssociatedLocation,
Country siteAssociatedCountry, Vector siteAssociatedDevices) {
super(siteName);
this.setCategoryCode(categoryCode);
this.setBeNumber(beNumber);
this.setOSuffix(oSuffix);
this.setPrimaryFunctionType(primaryFunctionType);
this.setStatus(status);
this.setRepairTime(repairTime);
this.setSiteAssociatedLocation(siteAssociatedLocation);
this.setSiteAssociatedCountry(siteAssociatedCountry);
this.setSiteAssociatedDevices(siteAssociatedDevices);
}

public Site()
{
super("");
}
public void setId(String id)
{
this.id = id;
}

public String getId()
{
return id;
}

public Site(String siteName) {
super(siteName);
}

public String getCategoryCode() {
return categoryCode;
}

public void setCategoryCode(String categoryCode) {
this.categoryCode = categoryCode;
}

public String getBeNumber() {
return beNumber;
}

public void setBeNumber(String beNumber) {
this.beNumber = beNumber;
}

public String getOSuffix() {
return oSuffix;
}

public void setOSuffix(String oSuffix) {
this.oSuffix = oSuffix;
}

public String getPrimaryFunctionType() {
return primaryFunctionType;
}

public void setPrimaryFunctionType(String primaryFunctionType) {
this.primaryFunctionType = primaryFunctionType;
}

public String getStatus() {
return status;
}

public void setStatus(String status) {
this.status = status;
}

public String getRepairTime() {
return repairTime;
}

public void setRepairTime(String repairTime) {
this.repairTime = repairTime;
}

public Country getSiteAssociatedCountry() {
return siteAssociatedCountry;
}

public void setSiteAssociatedCountry(Country siteAssociatedCountry) {
this.siteAssociatedCountry = siteAssociatedCountry;
}

public Location getSiteAssociatedLocation() {
return siteAssociatedLocation;
}

public void setSiteAssociatedLocation(Location siteAssociatedLocation) {
this.siteAssociatedLocation = siteAssociatedLocation;
}

public Vector getSiteAssociatedDevices() {
return siteAssociatedDevices;
}

public void setSiteAssociatedDevices(Vector siteAssociatedDevices) {
this.siteAssociatedDevices = siteAssociatedDevices;
}

public void addSiteAssociatedDevice(Device siteAssociatedDevice) {
if(siteAssociatedDevices == null) siteAssociatedDevices = new Vector();
this.siteAssociatedDevices.add(siteAssociatedDevice);
}

public void removeSiteAssociatedDevice(Device siteAssociatedDevice) {
this.siteAssociatedDevices.remove(siteAssociatedDevice);
}

public String getoSuffix() {
return oSuffix;

}

public void setoSuffix(String oSuffix) {
this.oSuffix = oSuffix;
}
public void setTracks(List tracks) {
this.track = tracks;
}
public List getTracks() {
return track;
}


And in conclusion my method used to kick off of the query:



try {

Session session = HibernateUtil.currentSession();

org.hibernate.Query query = session.createQuery("SELECT BE_NUMBER FROM FAC");

query.list();

session.close();

}
catch (Exception e) {
JOptionPane.showMessageDialog(null, "No Site", "problem pulling sites", 0);
}



}


hibernate_problem.txt
I am getting the following error when I try to map the FAC table in
my database:


17:08:02,939 ERROR PARSER:35 - *** ERROR: FAC is not mapped.

I'm using hibernate 3.0.3:

The primary key is the column FAC_SK which is a numeric sql type. I
think that means it
maps to a Java type of BigDecimal. I noticed in the docs that
hibernate maps to a long, short, int or a string. To do a simple pull
of data I've attempted to use another column with a String type. The
use of the String did not work. I'm not sure if the number 35 in the
error message is a type of error identifier, and if it is what it
stands for. Can I map this table using a Numeric sql type or do I
need to use some other method? The database I am using is Sybase.



Any help would be greatly appreciated.



My Mapping file is as follows:

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class name=Site"
table="FAC">
<id name="id"
type="string"
unsaved-value="null">
<column name="FAC_NAME"
sql-type="string"
not-null="true"/>
<generator class="uuid.hex"/>
</id>

<property name="BeNumber" column = "BE_NUMBER" type="string"/>

<property name="PrimaryFunctionType" column = "CATEGORY" type="string"/>

<property name="CategoryCode" column = "CC" type="string"/>


<property name="status" column = "OPER_STATUS"/>


<property name="OSuffix" column = "OSUFFIX" type="string"/>


<property name="RepairTime" column = "REVIEW_DATE" type="string" />


<bag name = "tracks" cascade="delete">
<key column = "EQP_NAME"/>
<one-to-many class = "Device"/>
</bag>
</class>


<class name = "Device" table = "EQP">
<id name = "id" >
<generator class="uuid.hex"/>
</id>

</class>
</hibernate-mapping>



My Source Code for the mapping class is here:




package mil.af.lackland.ewme.ontology;
/*
* Site.java
*
* Created on October 22, 2003, 3:18 PM
*/
import java.io.Serializable;
import java.util.List;
import java.util.Vector;
import java.math.BigDecimal;
import javax.sql.rowset.serial.SerialBlob;
import java.sql.Blob;

/**
*
* @author bh0841
*/
public class Site extends Space implements Serializable {
private String categoryCode = null;
private String beNumber = null;
private String oSuffix = null;
private String primaryFunctionType = null;
private String status = null;
private String repairTime = null;
private Location siteAssociatedLocation = null;
private Country siteAssociatedCountry = null;
private Vector siteAssociatedDevices = null;
private java.util.List track = null;
private String id;


/** Creates a new instance of Site */
public Site(String siteName, String categoryCode, String beNumber,
String oSuffix, String primaryFunctionType, String status,
String repairTime, Location siteAssociatedLocation,
Country siteAssociatedCountry, Vector siteAssociatedDevices) {
super(siteName);
this.setCategoryCode(categoryCode);
this.setBeNumber(beNumber);
this.setOSuffix(oSuffix);
this.setPrimaryFunctionType(primaryFunctionType);
this.setStatus(status);
this.setRepairTime(repairTime);
this.setSiteAssociatedLocation(siteAssociatedLocation);
this.setSiteAssociatedCountry(siteAssociatedCountry);
this.setSiteAssociatedDevices(siteAssociatedDevices);
}

public Site()
{
super("");
}
public void setId(String id)
{
this.id = id;
}

public String getId()
{
return id;
}

public Site(String siteName) {
super(siteName);
}

public String getCategoryCode() {
return categoryCode;
}

public void setCategoryCode(String categoryCode) {
this.categoryCode = categoryCode;
}

public String getBeNumber() {
return beNumber;
}

public void setBeNumber(String beNumber) {
this.beNumber = beNumber;
}

public String getOSuffix() {
return oSuffix;
}

public void setOSuffix(String oSuffix) {
this.oSuffix = oSuffix;
}

public String getPrimaryFunctionType() {
return primaryFunctionType;
}

public void setPrimaryFunctionType(String primaryFunctionType) {
this.primaryFunctionType = primaryFunctionType;
}

public String getStatus() {
return status;
}

public void setStatus(String status) {
this.status = status;
}

public String getRepairTime() {
return repairTime;
}

public void setRepairTime(String repairTime) {
this.repairTime = repairTime;
}

public Country getSiteAssociatedCountry() {
return siteAssociatedCountry;
}

public void setSiteAssociatedCountry(Country siteAssociatedCountry) {
this.siteAssociatedCountry = siteAssociatedCountry;
}

public Location getSiteAssociatedLocation() {
return siteAssociatedLocation;
}

public void setSiteAssociatedLocation(Location siteAssociatedLocation) {
this.siteAssociatedLocation = siteAssociatedLocation;
}

public Vector getSiteAssociatedDevices() {
return siteAssociatedDevices;
}

public void setSiteAssociatedDevices(Vector siteAssociatedDevices) {
this.siteAssociatedDevices = siteAssociatedDevices;
}

public void addSiteAssociatedDevice(Device siteAssociatedDevice) {
if(siteAssociatedDevices == null) siteAssociatedDevices = new Vector();
this.siteAssociatedDevices.add(siteAssociatedDevice);
}

public void removeSiteAssociatedDevice(Device siteAssociatedDevice) {
this.siteAssociatedDevices.remove(siteAssociatedDevice);
}

public String getoSuffix() {
return oSuffix;

}

public void setoSuffix(String oSuffix) {
this.oSuffix = oSuffix;
}
public void setTracks(List tracks) {
this.track = tracks;
}
public List getTracks() {
return track;
}


And in conclusion my method used to kick off of the query:



try {

Session session = HibernateUtil.currentSession();

org,hibernate.Query query = session.createQuery("SELECT
BE_NUMBER FROM FAC");

query.list();

session.close();

}
catch (Exception e) {
JOptionPane.showMessageDialog(null, "No Site", "problem
pulling sites", 0);
}



}


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.