Hibernate GenericJDBException

2 respostas
P

Galera,

Me deparei com um erro que já estou buscando a solução desde quinta-feira passada, já procurei aqui no guj, no google e não achei nada.
Estou com uma aplicação desktop que utiliza Hibernate para persistência. Após ter mapeado tudo com annotations, funciona tudo perfeitamente.

Ao realizar alguma busca, é que ele está quebrando tudo. Primeiro, começou a dar erro no lazy:

Exception in thread "AWT-EventQueue-0" org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: br.ufpe.cin.five.core.project.Project.speakers, no session or session was closed

Após rodar um pouco na internet, achei uma solução que funcionou aqui, adicionar a annotation: @LazyCollection(LazyCollectionOption.FALSE) forçando desligar o Lazy.

Ae beleza, não deu mais erro no Lazy.
Mas começou a aparecer esse erro:

ERROR [AWT-EventQueue-0] (TelaPrincipal.java:482) - RegisterException: org.hibernate.exception.GenericJDBCException: feature not supported:: NORMALIZE

Procurei na internet mas não achei nada que resolve-se meu problema.

Alguem pode me ajudar?

Ps.: Segue minhas classes, caso auxilie no entendimento do problema:

Classe mapeada(Project.java)
@Entity
public class Project {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)  
    private int id;
    private String name;
    private ProjectType type;
    private String directory;
    @ManyToMany(cascade = CascadeType.PERSIST)
    @LazyCollection(LazyCollectionOption.FALSE)
    private List<Speaker> speakers;
    @ManyToMany(cascade = CascadeType.PERSIST)
    @LazyCollection(LazyCollectionOption.FALSE)
    private List<Utterance> utterances;
    @ManyToMany(cascade = CascadeType.PERSIST)
    @LazyCollection(LazyCollectionOption.FALSE)
    private List<Sample> samples;
    @ManyToMany(cascade = CascadeType.PERSIST)
    @LazyCollection(LazyCollectionOption.FALSE)    
    private List<Extraction> extractions;    
    @LazyCollection(LazyCollectionOption.FALSE)
    @ManyToMany(cascade = CascadeType.PERSIST)
    private List<Classification> classifications;

hibernate.cfg.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>
    <!-- H2 -->
    <!-- 
    
    <property name="hibernate.connection.driver_class">org.h2.Driver</property>
    <property name="hibernate.connection.url">jdbc:h2:~/vocallab</property>
    <property name="hibernate.connection.username">sa</property>
    <property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</property>
    <property name="hibernate.default_schema">PUBLIC</property>
    <property name="show_sql">true</property>
    <property name="format_sql">true</property>
    <property name="hibernate.hbm2ddl.auto">update</property>
     
     --> 
     <!-- FIM DO H2 -->
        
        
        
     <!-- HSQL -->
    
    
    <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
    <property name="hibernate.connection.url">jdbc:hsqldb:file:/home/vocallab/Desktop/FIVE/Five</property>
    <property name="hibernate.connection.username">sa</property>
    <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
    <property name="hibernate.default_schema">PUBLIC</property>
    <property name="show_sql">true</property>
    
    <property name="hibernate.hbm2ddl.auto">update</property>
      
     
     <!-- FIM DO HSQL -->
     
           
        <mapping class="br.ufpe.cin.five.core.sample.SampleFilter" />
        <mapping class="br.ufpe.cin.five.core.utterance.Phrase" />
        <mapping class="br.ufpe.cin.five.core.utterance.Syllable" />
        <mapping class="br.ufpe.cin.five.core.utterance.Word" />
        <mapping class="br.ufpe.cin.five.core.utterance.Utterance" />
        <mapping class="br.ufpe.cin.five.core.speaker.Speaker" />
        <mapping class="br.ufpe.cin.five.core.sample.Sample" />
        <mapping class="br.ufpe.cin.five.core.extraction.Extraction" />
        <mapping class="br.ufpe.cin.five.core.classification.Classification" />
        <mapping class="br.ufpe.cin.five.core.project.Project" />


  </session-factory>
</hibernate-configuration>

Erro:

log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Classe: br
Classe: ufpe
Classe: cin
Classe: five
Classe: core
Classe: project
Classe: Project
Hibernate: select this_.id as id9_0_, this_.directory as directory9_0_, this_.name as name9_0_, this_.type as type9_0_ from PUBLIC.Project this_
Hibernate: select utterances0_.Project_id as Project1_9_1_, utterances0_.utterances_id as utterances2_1_, utterance1_.id as id4_0_, utterance1_.description as descript2_4_0_ from PUBLIC.Project_Utterance utterances0_ inner join PUBLIC.Utterance utterance1_ on utterances0_.utterances_id=utterance1_.id where utterances0_.Project_id=?
Hibernate: select speakers0_.Project_id as Project1_9_1_, speakers0_.speakers_id as speakers2_1_, speaker1_.id as id5_0_, speaker1_.age as age5_0_, speaker1_.gender as gender5_0_, speaker1_.name as name5_0_, speaker1_.region as region5_0_ from PUBLIC.Project_Speaker speakers0_ inner join PUBLIC.Speaker speaker1_ on speakers0_.speakers_id=speaker1_.id where speakers0_.Project_id=?
Hibernate: select samples0_.Project_id as Project1_9_3_, samples0_.samples_id as samples2_3_, sample1_.id as id6_0_, sample1_.audioFile as audioFile6_0_, sample1_.environment as environm3_6_0_, sample1_.featureFile as featureF4_6_0_, sample1_.genuine as genuine6_0_, sample1_.snr as snr6_0_, sample1_.speaker_id as speaker7_6_0_, sample1_.utterance_id as utterance8_6_0_, speaker2_.id as id5_1_, speaker2_.age as age5_1_, speaker2_.gender as gender5_1_, speaker2_.name as name5_1_, speaker2_.region as region5_1_, utterance3_.id as id4_2_, utterance3_.description as descript2_4_2_ from PUBLIC.Project_Sample samples0_ inner join PUBLIC.Sample sample1_ on samples0_.samples_id=sample1_.id left outer join PUBLIC.Speaker speaker2_ on sample1_.speaker_id=speaker2_.id left outer join PUBLIC.Utterance utterance3_ on sample1_.utterance_id=utterance3_.id where samples0_.Project_id=?
feature not supported:: NORMALIZE
org.hibernate.exception.GenericJDBCException: feature not supported:: NORMALIZE
ERROR [AWT-EventQueue-0] (TelaPrincipal.java:482) - RegisterException: org.hibernate.exception.GenericJDBCException: feature not supported:: NORMALIZE

2 Respostas

heatcold

O que tem na linha 482 da classe TelaPrincipal.java?
(onde ocorreu a exceção)

P

Vou colocar o código que vai chamando o DAO até dar o erro:

TelaPrincipal.java:

if (arquivo != null) {
            try {
                facade.openProject(arquivo); // O Erro ta aqui
                facade.initProjectRegisters();
            } catch (RegisterException ex) {
                logger.error(ex.getMessage());
                JOptionPane.showMessageDialog(null, ex.getMessage());
                return;
            }

Facade.java:

public void openProject(File projectFile) throws RegisterException {
        this.project = ProjectRegister.open(projectFile);      
    }

ProjectRegister.java (Método Open):

Project p = null;
            for(Object o : concreteDao.findAll(br.ufpe.cin.five.core.project.Project.class))
            {
                p = (Project)o;
                System.out.println(p.getName() + " == " + name + " ??");
                if(p.getName().equals(name))
                    break;
            }

ConcreteDAO.java(que implementa abstractDAO):

public List findAll(Class objType) throws DataAccessLayerExpection{
        return super.findAll(objType);
    }

AbstracdDAO.java(método findAll)

protected List findAll(Class clazz) {
        List objects = null;
        try {
            startOperation();
            String className[] = clazz.getName().split("\\."); 
            
            for(String a : className)
                System.out.println("Classe: " + a);
            
            //System.out.println("from " + className[className.length-1]);
            
           // Query query = session.createQuery("from " + className[className.length-1]);
            
          Criteria criteria = session.createCriteria(clazz);
           //objects = query.list();             
            objects = criteria.list();
            System.out.println("Lista de objetos obitda com sucesso!");
            tx.commit();
            
            
        } catch (HibernateException e) {
            System.out.println(e.getMessage());
            handleException(e);
        } finally {
            HibernateFactory.close(session);
        }
        return objects;
    }:
Criado 23 de janeiro de 2012
Ultima resposta 23 de jan. de 2012
Respostas 2
Participantes 2