-->
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.  [ 4 posts ] 
Author Message
 Post subject: Exception in runnig the Annotation
PostPosted: Wed Aug 06, 2008 8:43 am 
Beginner
Beginner

Joined: Sat May 31, 2008 2:35 am
Posts: 30
Location: pakistan
hi can some wone tell me what is the Exception which occuring in my application when ever i want to save my shange.. i want to integrate the Hibernate search but befor i want to use simple test of Annotation
and it given me that Exception please Guide me


Exception
-----------------------------------------------------------------------------
Initial SessionFactory creation failed.java.lang.VerifyError: (class: org/hibernate/search/event/FullTextIndexEventListener, method: onPostInsert signature: (Lorg/hibernate/event/PostInsertEvent;)V) Incompatible argument to function
Exception in thread "main" java.lang.ExceptionInInitializerError
at roseindia.HibernateUtil.<clinit>(HibernateUtil.java:15)
at roseindia.Example1.main(Example1.java:21)
Caused by: java.lang.VerifyError: (class: org/hibernate/search/event/FullTextIndexEventListener, method: onPostInsert signature: (Lorg/hibernate/event/PostInsertEvent;)V) Incompatible argument to function
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.hibernate.cfg.search.SearchConfiguration.enableHibernateSearch(SearchConfiguration.java:62)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:856)
at roseindia.HibernateUtil.<clinit>(HibernateUtil.java:11)
... 1 more
-------------------------------------------------------------------------------------

My Code is....


SessionFactory sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();


Session session = sessionFactory.getCurrentSession();

Transaction tx = session.beginTransaction();

tx.begin();
Seller os=new Seller();

os.setId(9);
os.setSellerName("ali");
os.setSellerRating("44");
os.setSellerURL("www.hibernate");
session.update(os);
tx.commit();
---------------------------------------------------------------------------


my annotation class is


import java.io.Serializable;
import javax.persistence.*;

import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;

@Entity
@Table(name = "Seller")
@Indexed(index="Seller")
public class Seller implements Serializable {


public Seller()
{
}
@DocumentId
@Id
@Column(name = "Seller_Id")
Integer id;

@Field(index=Index.TOKENIZED)
String SellerName;

@Field(index=Index.TOKENIZED)
String Seller_URL;

String SellerRating;


public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@Column(name = "SellerName")
public String getSellerName() {
return SellerName;
}

public void setSellerName(String SellerName) {
this.SellerName = SellerName;
}

@Column(name = "SellerURL")
public String getSellerURL() {
return Seller_URL;
}
public void setSellerURL(String SellerURL) {
this.Seller_URL = SellerURL;
}

@Column(name = "SellerRating")
public String getSellerRating() {
return SellerRating;
}
public void setSellerRating(String SellerRating) {
this.SellerRating = SellerRating;
}
}

----------------------------------------------------------------------


my hibernate.cfg.xml is




<?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>
<!-- Database connection settings -->
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/roseindia
</property>
<property name="connection.username">root</property>
<property name="connection.password"></property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">
org.hibernate.cache.NoCacheProvider
</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">none</property>

<property name="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider</property>
<property name="hibernate.search.default.indexBase">c:/myroseindia/lucene/indexes</property>
<property name="hibernate.archive.autodetection">class, hbm</property>


<mapping class="roseindia.Seller"/>


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
















[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 06, 2008 9:30 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

that looks like a classical version problem. Which versions of hibernate, annotations and search are you using? Also make sure that you don't have multiple versions of the dependencies in the classpath. Depending on the environment you are running in you might have eg some hibernate jars in the global container lib directory.

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 06, 2008 11:41 pm 
Beginner
Beginner

Joined: Sat May 31, 2008 2:35 am
Posts: 30
Location: pakistan
hello

thanx very much fr reading my problem and reply me...

basically this is my first time i m using annotation and hibernate search.

hibernate.search3.0.1

Hibernate-Version: 3.2.5.ga



so tell me wat is the basically problem and how i can remove it..

and assisit me how i can use annotation in a class which having
Foreign Key

like: my class have a foreign key and i set that annotaion with it

--------------------------------------------------------
@ManyToOne(targetEntity = SubCategory.class)
@JoinColumn(name = "Sub_Cat_Id", nullable = false)
private SubCategory Sub_Cat_Id;
----------------------------------

it is right way and which more annotaion can be addded if foreign key is in classes..


guide me these are too narrow question but i hope u will Guide me thanx in advance


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 07, 2008 3:36 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

I would recommend you use Hibernate Core 3.2.6.GA together with Annotations 3.3.1 GA and Search 3.0.1 GA.

If you can I recommend even to upgrade Core to 3.3.0 and using Search 3.1.0 CR1. In this case you will benefit from many bug fixes and feature enhancements in Search.

Check the compatibility matrix when choosing your dependecies: http://hibernate.org/6.html.

--Hardy


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