which the error?
I am not understanding, nothing.
I do not know which the problem.
Hibernate 2.1:
Mapping documents:
<hibernate-mapping>
<class name="dados.entity.Noticia" table="noticia">
<id name="id_noticia" column="id_noticia" type="int" unsaved-value="-1">
<generator class="native" />
</id>
<property name="titulo" column="titulo" type="string"/>
<property name="chamada" column="chamada" type="string"/>
<property name="link_da_noticia" column="link_da_noticia" type="string"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
try {
for(Iterator i=items.iterator(); i.hasNext(); ) {
ItemIF item = ( ItemIF )i.next();
Noticia noticia = new Noticia(item.getDescription(), item.getTitle(), item.getLink().toString());
Session session = HibernateUtil.currentSession();
Transaction tx = session.beginTransaction();
session.save(noticia);
tx.commit();
HibernateUtil.closeSession();
}
} catch (Exception e){
e.printStackTrace();
}
Full stack trace of any exception that occurs:
WARNING: SQL Error: 1146, SQLState: 42S02
15/07/2005 15:37:20 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Table 'maringasaude.hibernate_unique_key' doesn't exist
net.sf.hibernate.exception.SQLGrammarException: Could not save object
at net.sf.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:58)
at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at net.sf.hibernate.impl.SessionImpl.convert(SessionImpl.java:4131)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:794)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:749)
at dados.FolhaOnLineInforma.Cadastrar.processar(Cadastrar.java:35)
at dados.FolhaOnLineInforma.Folha.cadastrar(Folha.java:24)
at folhaonlinersscadastrator.Main.main(Main.java:12)
Caused by: java.sql.SQLException: Table 'maringasaude.hibernate_unique_key' doesn't exist
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2851)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1534)
at com.mysql.jdbc.ServerPreparedStatement.serverPrepare(ServerPreparedStatement.java:1485)
at com.mysql.jdbc.ServerPreparedStatement.<init>(ServerPreparedStatement.java:151)
at com.mysql.jdbc.Connection.prepareStatement(Connection.java:1309)
at com.mysql.jdbc.Connection.prepareStatement(Connection.java:1281)
at net.sf.hibernate.id.TableGenerator.generate(TableGenerator.java:92)
at net.sf.hibernate.id.TableHiLoGenerator.generate(TableHiLoGenerator.java:59)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:776)
... 4 more
Name and version of the database you are using:
MySQL 4.1.12a-nt-max
Debug level Hibernate log excerpt:
|