-->
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.  [ 2 posts ] 
Author Message
 Post subject: getting exception when using hibernate tools
PostPosted: Thu Jul 31, 2008 11:33 am 
Beginner
Beginner

Joined: Fri May 16, 2008 3:59 pm
Posts: 30
I m using hibernate tools.
I get this when I run my code:
Code:

try{
         session = HibernateUtil.getSessionFactory().openSession();
         tx = session.beginTransaction();
         System.out.println("Session started...");
         
            
            Iterator<FinancialAccount> it = accounts.iterator();
            System.out.println("Iterator created..");
            System.out.println(accounts.size());
            while(it.hasNext()){
               System.out.println("Saving...");
               FinancialAccount fa = it.next();
               session.saveOrUpdate(fa);
               
            }
         
            
         }catch(TransactionException te){
            te.printStackTrace();
            log.error(te.getMessage());
         }catch(HibernateException e){
            e.printStackTrace();
            log.error(e.getMessage());
         }catch(Exception e){
            e.printStackTrace();
            log.error(e.getMessage());
         }
         tx.commit();

Mapping:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                                   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Jun 30, 2008 3:14:12 PM by Hibernate Tools 3.2.1.GA -->
<hibernate-mapping>
<class catalog="brokerage" name="tradeloader.Position" table="Position">
  <composite-id class="tradeloader.PositionId" mapped="false" name="id" unsaved-value="undefined">
   <key-property name="fundname" type="string">
    <column length="25" name="fundname"/>
   </key-property>
   <key-property name="accountnumber" type="string">
    <column length="20" name="accountnumber"/>
   </key-property>
   <key-property name="cusip" type="string">
    <column length="9" name="cusip"/>
   </key-property>
   <key-property name="dealernumber" type="string">
    <column length="25" name="dealernumber"/>
   </key-property>
  </composite-id>
  <property generated="never" lazy="false" name="shares" type="big_decimal">
   <column name="shares" precision="16" scale="3"/>
  </property>
  <property generated="never" lazy="false" name="value" type="big_decimal">
   <column name="value" precision="16"/>
  </property>
  <property generated="never" lazy="false" name="ssn" type="string">
   <column length="25" name="ssn"/>
  </property>
  <property generated="never" lazy="false" name="branchnumber" type="string">
   <column length="9" name="branchnumber"/>
  </property>
  <property generated="never" lazy="false" name="fundcode" type="string">
   <column length="7" name="fundcode"/>
  </property>
  <property generated="never" lazy="false" name="unissuedshares" type="big_decimal">
   <column name="unissuedshares" precision="10" scale="3"/>
  </property>
  <property generated="never" lazy="false" name="issuedshares" type="big_decimal">
   <column name="issuedshares" precision="10" scale="3"/>
  </property>
  <property generated="never" lazy="false" name="nav" type="big_decimal">
   <column name="nav" precision="10"/>
  </property>
  <property generated="never" lazy="false" name="extunitvalue" type="big_decimal">
   <column name="extunitvalue" precision="10"/>
  </property>
  <property generated="never" lazy="false" name="accrueddividend" type="big_decimal">
   <column name="accrueddividend" precision="10"/>
  </property>
  <property generated="never" lazy="false" name="subaccountint" type="big_decimal">
   <column name="subaccountint" precision="10"/>
  </property>
  <property generated="never" lazy="false" name="maturitydate" type="string">
   <column length="8" name="maturitydate"/>
  </property>
  <property generated="never" lazy="false" name="collectedbalance" type="big_decimal">
   <column name="collectedbalance" precision="10"/>
  </property>
  <property generated="never" lazy="false" name="repnumber" type="string">
   <column length="9" name="repnumber"/>
  </property>
  <property generated="never" lazy="false" name="repname" type="string">
   <column length="30" name="repname"/>
  </property>
  <property generated="never" lazy="false" name="ssnstatus" type="string">
   <column length="45" name="ssnstatus"/>
  </property>
  <property generated="never" lazy="false" name="navcode" type="string">
   <column length="1" name="navcode"/>
  </property>
  <property generated="never" lazy="false" name="schedulingcode" type="string">
   <column length="1" name="schedulingcode"/>
  </property>
</class>
</hibernate-mapping>


Stack Trace:

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Position.hbm.xml"]")' at line 1
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1026)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
        at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1564)
        at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1485)
        at org.apache.log4j.jdbc.JDBCAppender.execute(JDBCAppender.java:178)
        at org.apache.log4j.jdbc.JDBCAppender.flushBuffer(JDBCAppender.java:250)
        at org.apache.log4j.jdbc.JDBCAppender.append(JDBCAppender.java:146)
        at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
        at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
        at org.apache.log4j.Category.callAppenders(Category.java:206)
        at org.apache.log4j.Category.forcedLog(Category.java:391)
        at org.apache.log4j.Category.log(Category.java:856)
        at org.apache.commons.logging.impl.Log4JLogger.debug(Log4JLogger.java:110)
        at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1592)
        at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1561)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1540)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1514)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1434)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1420)
        at tradeloader.HibernateUtil.<clinit>(HibernateUtil.java:13)
        at java.lang.J9VMInternals.initializeImpl(Native Method)
        at java.lang.J9VMInternals.initialize(J9VMInternals.java:194)
        at ameritrade.Parser.parseFile(Parser.java:216)
        at ameritrade.Controller.main(Controller.java:7)


I can't pinpoint the problem?!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 05, 2008 4:27 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
well the error talks about Position.hbm.xml string being passed on to your jdbc driver...

1) that makes zero sense

2) you don't list anything in your files about Position.hbm.xml so something must be missing.

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.