Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Unable to read a db table(Eclipselink Query problem)
Unable to read a db table [message #1033585] Thu, 04 April 2013 12:02 Go to next message
Neil Cohen is currently offline Neil Cohen
Messages: 12
Registered: June 2012
Junior Member
I have been using Eclipselink for some time now, but today it started causing problems for me. I am working with the Vaadin development environment, and Java 7. All of a sudden, EclipseLink is failing... I hope someone can help me with this - I'm way outside my area of expertise here...

The situation is this - I have a database table that I am trying to load, and Eclipselink started telling me that one of the fields is missing. But it is in the table

Here is the table definition and the code used to read it:

--
-- Table structure for table `interface_detail`
--

DROP TABLE IF EXISTS `interface_detail`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `interface_detail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `asset_member_id` int(11) DEFAULT NULL,
  `interface_type` int(11) DEFAULT NULL,
  `admin_status` varchar(32) COLLATE latin1_general_cs DEFAULT NULL,
  `link_speed` int(11) DEFAULT NULL,
  `mac_address` varchar(32) COLLATE latin1_general_cs DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `ki_asset_member_id` (`asset_member_id`),
  CONSTRAINT `ki_asset_member_id` FOREIGN KEY (`asset_member_id`) REFERENCES `asset_member` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=460111 DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs;
/*!40101 SET character_set_client = @saved_cs_client */;


    List<InterfaceDetail> l_Interface_Detail = null;

    em = getEntityManager();
    Query q = em.createQuery("select idet from InterfaceDetail as idet");
    l_Interface_Detail = q.getResultList();
    em.close();

    return(l_Interface_Detail);


Here is my persistence.xml file. I've changed some pathnames and removed some extraneous classes...

<persistence-unit name="JART_DB_Lib" transaction-type="RESOURCE_LOCAL">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <class>com.verisign.jart.common.dm.HostInfo</class>
        <class>com.verisign.jart.common.dm.InterfaceDetail</class>
        ...
        <class>com.verisign.jart.common.dm.User</class>
        <properties>
            <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
            <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/mydatabase" />
            <property name="javax.persistence.jdbc.user"   value="username" />
            <property name="javax.persistence.jdbc.password" value="mypassword" />
            <property name="eclipselink.logging.file" value="/tmp/eclipselink.log"/>
            <property name="eclipselink.logging.logger" value="JavaLogger"/>
            <property name="eclipselink.logging.level" value="FINEST"/>
            <property name="eclipselink.logging.level.sql" value="FINEST"/>
            <property name="eclipselink.logging.parameters" value="true"/>
        </properties>
    </persistence-unit>


With the debugging, I see that eclipselink is changing the field names from lower case to upper case on other database tables - like this:

CONFIG: The column name for element [id] is being defaulted to: ID.


But not for this table. The error I see is this:

Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'interface_type' in 'field list'
Error Code: 1054
Call: SELECT id, admin_status, interface_type, link_speed, mac_address, asset_member_id FROM interface_detail
Query: ReadAllQuery(referenceClass=InterfaceDetail sql="SELECT id, admin_status, interface_type, link_speed, mac_address, asset_member_id FROM interface_detail")


If I copy the select statement from the log file (SELECT id, admin_status, interface_type....) and run it on the command line, it returns 400k valid records. So the data is there
and the field names are valid. But it looks like Eclipselink thinks they should be upper case, and they are not.

I really hope someone can clue me in here. I'm not sure where to look at this point... Any help or pointers would be greatly appreciated.

Thanks in advance

nbc
Re: Unable to read a db table [message #1033813 is a reply to message #1033585] Thu, 04 April 2013 17:18 Go to previous message
Neil Cohen is currently offline Neil Cohen
Messages: 12
Registered: June 2012
Junior Member
Problem solved - tracked it down to a typo.... Spent too much time staring at it - couldn't see the forest for the trees.

Sorry to bother you...

nbc
Previous Topic:Commit object with ID
Next Topic:What happened in "Query"
Goto Forum:
  


Current Time: Thu Oct 23 01:58:33 GMT 2014

Powered by FUDForum. Page generated in 0.01435 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software