SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye

Welcome, Guest
Guest Settings
Help

Compass Support Forums » Compass » Compass Users

Thread: what's event that trigger mirroring for JDBC compass?

This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 62 - Pages: 5 [ 1 2 3 4 5 | Next ] - Last Post: Dec 16, 2011 9:27 PM Last Post By: hua12
Rid

Posts: 46
Registered: 6/3/07
what's event that trigger mirroring for JDBC compass?
Posted: Aug 13, 2007 6:19 AM
 
  Click to reply to this thread Reply
Hello,

In spring IOC I added
     <bean id="jdbcGpsDevice" class="org.compass.gps.device.jdbc.ResultSetJdbcGpsDevice">
       <property name="name"><value>jdbcDevice</value></property>
       <property name="dataSource"><ref bean="dataSource" /></property>
       <property name="mirrorDataChanges"><value>true</value></property>
       <property name="mappings">
        <list>
          <ref local="rsMapping" />
        </list>
       </property>
     </bean>

and i was hoping that it works and mirror as it works and mirrors with hibernate instantly. I know that compass uses hibernate listners to peform mirroring as any indexed object is updated, and there is also hibernate filter. However,when i use compass JDBC, whenever i update DB it doesn't reflect changed values till i call getCompassGps().index(). Is there a specific way that only then compass get notified to update index?

Finally, I added the property "deleteIndexBeforeIndex" and set it to true in IOC container of spring. However, it told me that there is no such setter for this property in
org.compass.gps.impl.SingleCompassGps

<property name="deleteIndexBeforeIndex"><value>true</value></property>

I looked in source code, and i couldn't find such prop! I use version 1.2M2

Hope some one help me!
Shay Banon

Posts: 4,028
Registered: 9/6/05
Re: what's event that trigger mirroring for JDBC compass?
Posted: Aug 14, 2007 12:54 PM   in response to: Rid in response to: Rid
 
  Click to reply to this thread Reply
With pure Jdbc device, mirroring can only be performed when Compass is configured to use some sort of a version column to identify changes done on the DB level. There is no way to integrate with any "mirroring event" as there are none when using pure Jdbc vs. Hibernate.
Rid

Posts: 46
Registered: 6/3/07
Re: what's event that trigger mirroring for JDBC compass?
Posted: Aug 15, 2007 7:59 AM   in response to: Shay Banon in response to: Shay Banon
 
  Click to reply to this thread Reply
so with JDBC device adding a new row to DB directly or via JDBC APIs won't update the index with new inserted rows untill i call getCompassGps().index() even when i use version column? right?
Ok I can know the ID of inserted object , updated, or deleted. isn't there a way to tell JDBC device the add a new doc that represent the new added row if i have the ID of the row in DB.
The situation i have is: I save objects using Hibernate, however try to use JDBC device to avoid setting lazy="false" in HBMs to get rid of lazy initialization exception when compass tries to load objects in Hibernate listener.

would u help plz?
Shay Banon

Posts: 4,028
Registered: 9/6/05
Re: what's event that trigger mirroring for JDBC compass?
Posted: Aug 17, 2007 6:17 AM   in response to: Rid in response to: Rid
 
  Click to reply to this thread Reply
If you are using the Gps Jdbc device, Compass does not know about Objects or Hibernate, so how do you get the exception?
Rid

Posts: 46
Registered: 6/3/07
Re: what's event that trigger mirroring for JDBC compass?
Posted: Aug 18, 2007 3:51 AM   in response to: Shay Banon in response to: Shay Banon
 
  Click to reply to this thread Reply
ok, look!
I first started using Compass hibernate device.
That let to get lazy initialization exception when doing lazy initialization in hibernate listner.
To get Rid of that i set lazy=fasle for the needed fields in hbms.
Things went fine for compass and hibernate however, too many objects keep loading with no benifit so i tried to use JDBC device.
The porblem with JDBC device is, as i stated before, it's not detecting DML operations that take place to mirror them to index. Mirroring is not performed untill i call getCompassGps().index(). I do use version column for each table when i use JDBC device.

what i got from you is that: the is no event that could be exploited to tell JDBC gps device to mirror changes that happen to DB, even when using version column.

So I need a way, if any, to explicitly tell compass with JDBC device to add, update, or delete decument every time i insert, update, or delete a record in tables that are mapped using JDBC device.

I hope this explain the status I have clearly.. and I do hope that there is a way to tell JDBC device to automaticly update the index as I do DML oprations, not only when getCompssGps().index() is called. Again, version column is used!
msolnit

Posts: 108
Registered: 10/12/06
Re: what's event that trigger mirroring for JDBC compass?
Posted: Aug 23, 2007 4:52 PM   in response to: Rid in response to: Rid
 
  Click to reply to this thread Reply
Hi Rid. Unfortunately, I don't think there is any way in Compass to do this. You have to write your own code to call Compass whenever a database row is changed.

Hope this helps.

-- Matt
Briggs

Posts: 19
Registered: 8/9/07
Re: what's event that trigger mirroring for JDBC compass?
Posted: Aug 27, 2007 8:30 AM   in response to: msolnit in response to: msolnit
 
  Click to reply to this thread Reply
Well, there is a way. When you insert, call index(). I suppose, that depending on what type of db you are using, you could write a trigger that fires off some event that can be sent to something listening within your application, or a message queue. But, JDBC does not provide a callback/event system for notification of changes within a DB. This isn't a Compass limitation, it's a DB limitation.

I suppose another thing you could do is create a thread that polls your database every n-seconds to check for newly added items. If it detects one, it calls index().

But, again the JDBC device is what I would call "passive". It doesn't know anything about events in your data model.
Rid

Posts: 46
Registered: 6/3/07
Re: what's event that trigger mirroring for JDBC compass?
Posted: Aug 27, 2007 9:17 AM   in response to: Briggs in response to: Briggs
 
  Click to reply to this thread Reply
Calling index() every DML operation is too much bad idea. Cause it does re-building the entier index, and synchronize the whole DB. So it's resource consuming and so slow. It takes toooooo much time to re-index a milion enteris.

Adding triggers could be helpful if you plan to do something on DB, but it doesn't let you to something in your java code, and again this is where your compass code works

collecting new items every n seconds is also not a good idea. cause you may have something updated and deleted. so it's the worst thing to just worry about newly inserted rows.

If compass can offer a way to have a listener and the coder of the application will fire the event the the listener of compass wiil listen to it, and does the needed modifications to the index. the event could be fired with some AOP config. or something like that! i hope that Shay will comment about this suggestion
Shay Banon

Posts: 4,028
Registered: 9/6/05
Re: what's event that trigger mirroring for JDBC compass?
Posted: Aug 29, 2007 11:30 AM   in response to: Rid in response to: Rid
 
  Click to reply to this thread Reply
If you have a DAO layer that has something like: CustomerDAO#saveCustomer, then you can easily write an aspect that also index the customer using Compass. Check out the Compass Spring AOP integration for such an aspect. support.

Regarding reindexing of the data, and the fact that it takes a long time, you can solve this as well. If you are starting with a clean index, you can use the BATCH_INSERT transaction isolation level that will perform faster.
Rid

Posts: 46
Registered: 6/3/07
Re: what's event that trigger mirroring for JDBC compass?
Posted: Sep 4, 2007 4:45 AM   in response to: Shay Banon in response to: Shay Banon
 
  Click to reply to this thread Reply
http://forums.opensymphony.com/thread.jspa?threadID=119866&tstart=0
louisvuittonbox

Posts: 411
Registered: 8/23/11
Re: what's event that trigger mirroring for JDBC compass?
Posted: Aug 23, 2011 10:05 PM   in response to: Rid in response to: Rid
 
  Click to reply to this thread Reply
Sports brand Nike (Nike) has announced the new 2010 summer footwear, including the nike air max, Tennis Classic, and Air Max 90 Current Torch three groups. nike shox which are yellow, orange, and blue color, with some bright colors there is a refreshing feeling. Tennis Classic with a white and green color, low-cut shoes suitable for summer wear. And with the nike air jordan of the latest technology Torch nike shoes uk Current Torch shoes are hit with the classic black and white color with the toe position with the Torch materials, mining forefoot nike air max 2011 Free technology coupled with the classic appearance , reflecting the retro and technology integration.
guge

Posts: 6
Registered: 9/7/11
Re: what's event that trigger mirroring for JDBC compass?
Posted: Sep 7, 2011 9:32 PM   in response to: Rid in response to: Rid
 
  Click to reply to this thread Reply
qiangfengying42

Posts: 64
Registered: 9/9/11
Re: what's event that trigger mirroring for JDBC compass?
Posted: Sep 9, 2011 9:50 PM   in response to: Rid in response to: Rid
 
  Click to reply to this thread Reply
Supra is a brand Buy Supra Shoes that has been inspired Supra Skytop Shoes UK , designed and marketed Supra Skytop II Shoes by passionate individuals Supra Skytop 3 . Supra shoes strive to Supra TK Society create new and original classics Supra Society Shoes UK for people who demand detail Supra Vaider Shoes and quality. Supra shoes are worn Womens Supra Shoesby an all star roster of Asics Gel Kinsei 2 Sale athletes and musicians, including Asics Gel Lyte III Terry Kennedy, Erik Eillington, Cheapeat Asics Running Shoes Jim Greco, Chad Muska, Tom Penny, qiangfengying420 and Antwuan Dixon.
qiangfengying42

Posts: 64
Registered: 9/9/11
Re: what's event that trigger mirroring for JDBC compass?
Posted: Sep 9, 2011 9:51 PM   in response to: Rid in response to: Rid
 
  Click to reply to this thread Reply
Tods bags light Tods Handbags Sale and combination provides Tods Outlet high quality, the classical Tods Sale perfect interpretation of Tods Floral Lace Shoes Sale individual character! Tod's Tods Flats Sale Handbags is one of Tod's Gommino the most famous bags series Tod's Heaven . Elegant, luxurious without exaggeration Tods Discount , without its shortcomings taste Tods On Sale , the best quality.Free Shipping Tods Outlet,7-12 days to worldwide. 100% Tods Sale Satisfaction and Money Back Guarantee Tods Shoes Outlet ! More of cheap tods online qiangfengying420!
feifei

Posts: 128
Registered: 9/5/11
Re: what's event that trigger mirroring for JDBC compass?
Posted: Sep 13, 2011 3:27 AM   in response to: Rid in response to: Rid
 
  Click to reply to this thread Reply
We are the best soccer jersey supplier, all the soccer jerseys on jerseybbs.com are REPLICA SOCCER JERSEYS, but their quality are good, because many soccer jersey shopping websites are selling our discount soccer jerseys, espcially the thailand quality cheap soccer jerseys, They are the same as the official jerseys

According to a figure that most of the luxury brands consumer in China range frome 2os to 30s.
wholesale polo shirts are all young Women's love, wearing the designers will attract passerby glance, it make them be in good mood all the day.

feidufang
With the increase in printing needs all over the world, manufacturers of Ink Cartridges are hard pressed to meet the ever-increasing demand. Consumer satisfaction ranks highest in the quest to fulfill company priorities. Buying printers is relatively cheap nowadays, but unfortunately, the Ecco Key West Mens same thing cannot be said about the CISS or cartridges that require to be replaced often.

cocogamer.com is one of most reliable sellers which engage in r4i gold and r4i sdhc , including all the most popular R4i and R4 3DS Cards at favorable price
China Ceramic Tile Manufacturer exporter and supplier with a factory in China, manufacture all kinds of Ceramic Tile, wall tiles, Floor Tiles!


The online store to buy replica Louis Vuitton bags, wallets and purse of top most designer

R4 Series,r4i Series,R4DS,R4i SDHC,R4i Gold,R4i Card for NDSi XL/NDSi/DSL/NDS - UseeGames.Com




Legend
Guru: 2001 + pts
Expert: 501 - 2000 pts
Super-star: 101 - 500 pts
Assistant: 51 - 100 pts
Participant: 0 - 50 pts
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums