SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye

Welcome, Guest
Guest Settings
Help

Compass Support Forums » Compass » Compass Users

Thread: Getting started with JPA/EJB3

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


Permlink Replies: 14 - Pages: 1 - Last Post: Nov 29, 2011 1:28 AM Last Post By: north face clea...
jkario

Posts: 2
Registered: 7/24/07
Getting started with JPA/EJB3
Posted: Jul 24, 2007 8:45 AM
 
  Click to reply to this thread Reply
I'm finding it really hard the get started with JPA and compass. There appears to be very few examples around. I'm using JBoss 4.2 (Hibernate Entitymanager). I'm using plain EJB3 with session beans and annotated JPA pojos.

1. Where and when I need to call CompassGps.index method manually? EJB timer?
2. The underlying code creates a new employee to the database. How come I have to manually call the CompassSession.save method? I though gps stuff takes care of updating the index in the background
3. CompassGps.start presumably start some background processes / threads. Is this the right place to call the start method? Session beans methods should not spawn any threads.

public Employee createEmployee(Employee emp) {

CompassGps gps = new SingleCompassGps(CompassHelper.getCompass());
CompassGpsDevice jpaDevice =
new JpaGpsDevice("jpa", emf);
CompassSession session = CompassHelper.getCompass().openSession();

gps.addGpsDevice(jpaDevice);
gps.start();

em.persist(emp);
session.save(emp);

//gps.index();

session.close();

return emp;
}
Shay Banon

Posts: 4,028
Registered: 9/6/05
Re: Getting started with JPA/EJB3
Posted: Jul 25, 2007 6:12 AM   in response to: jkario in response to: jkario
 
  Click to reply to this thread Reply
CompassGps and Compass should be started globally with your application. With JBoss, you can do it as a JMX bean (don't know exactly how).

When you configure JpaGpsDevice, make sure to call setInjectEntityLifecycleListener so Compass would inject lifecycle listeners to mirror changes made through the EntityManager to Compass.

CompassGps#index will completely reindex your database content into the search engine based on your Compass mappings and JPA mappings. So you would need to call it once to get the index up to date, and let mirroring mirror changes later on.

So, last, when you have a code such as createEmployee, there is no need to have any Compass APi there (thanks to mirroring).

Hope this answers your questions, if not, ping back...
jkario

Posts: 2
Registered: 7/24/07
Re: Getting started with JPA/EJB3
Posted: Jul 25, 2007 7:05 AM   in response to: Shay Banon in response to: Shay Banon
 
  Click to reply to this thread Reply
Thanks! Just the thing I was looking for.

I managed to get it working using the following steps

1. Use singleton pattern for holding Compass and CompassGps instances. Created CompassHelper class with static instance variables for Compass and CompassGps
2. ServletContextListener which initializes compass by calling initializeCompass method of my CompassBean session bean. initializeCompass takes care of calling the setInjectEntityLifecycleListener method. Apparently compass initialization need to be in the session bean because the JPA POJOs are not visible in the web classloader. Tried first to initialize compass directly in the ServletContextListener.
3. Start a thread in the ServletContextListener which periodically calls index method of my CompassBean session bean to do full reindex. We are using plain SQL / SQL scripts to import initial data to the database and we also modify the test data by hand so it's nice to have the those changes reflected in the index. Index method of the session bean needs to annotated with @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) because CompassGps.inxex wants to be called without transaction.
Ben Erridge

Posts: 25
Registered: 3/8/09
Re: Getting started with JPA/EJB3
Posted: Mar 8, 2009 10:58 AM   in response to: jkario in response to: jkario
 
  Click to reply to this thread Reply
I'm having same difficulties can anyone post a simple example using jsf/compass/jpa ? Would be very helpful.
Thanks!
linzhen

Posts: 38
Registered: 9/9/11
uk ugg boots
Posted: Nov 9, 2011 9:25 PM   in response to: jkario in response to: jkario
 
  Click to reply to this thread Reply
the men who need to stay in spyder coats style without losing comfort.The issue with using spyder jackets sale this method is that the lining does columbia jackets not tend to cope as well and columbia coats because they fibers are short they start columbia clearance to fall out.So over time finally australia uggs sale they boots won’t be able to wick australia ugg uk away the moisture and prevent your feet Columbia Jackets from getting chilled.The material used in Columbia Jackets Sale Ugg boots is so effect that it cheap columbia jackets can wick away 70% of the moisture columbia jackets women that your feet produces so unlike other women ugg boots styles of these boots where synthetic materials ugg boots sale are used to line them you don’t spyder jackets finish up with smelly feet.A similar case mens spyder jackets
tinny butcher

Posts: 15
Registered: 11/10/11
Re: Getting started with JPA/EJB3
Posted: Nov 10, 2011 12:14 AM   in response to: jkario in response to: jkario
 
  Click to reply to this thread Reply
Such as the hair feathers extensions wholesale that have been greatly talked about, clip in featherlocks locks extensions started to become a fascinating and will be hot topic dialogue. The reason why Because hair feather kits cut within have several advantages associated with ordinary feather plug-ins which range from how you can setup, style and agreement of colors that is set up properly, up to the cost is comparatively cheaper than regular feather extensions within blonde hair on several sellers.
hath80

Posts: 17
Registered: 10/25/11
Re: Getting started with JPA/EJB3
Posted: Nov 10, 2011 12:44 AM   in response to: jkario in response to: jkario
 
  Click to reply to this thread Reply
iPhone Video Converter Suite is all-in-one iPhone video Conversion software. This suite includes iPhone Video Converter and DVD to iPhone Converter . So with this iPhone Video Converter suite, you can convert both DVD’s and video files to your iPhone video. You can enjoy your favorite DVD’s and video movies on your iPhone as a portable DVD Player. Now you can get this iPhone Converter Suite at a very competitive price!

* Rip & convert almost any DVD movies to iPhone video files
* Convert all pop videos for iPhone, such as AVI, DivX, WMV, MOV, MPEG
* Easy to use and user-friendly interface
* Super fast speed and high quality
* Support iPhone 4S, iPhone 4, iPhone 3GS, iPhone 3G, iPod, iPad, more.

More products you may be interested in:
iPad Video Converter Suite , iPod Video Converter Suite , iMate , DVD Converter Suite , DVD Creator , DRM Media Converter , Video Converter Ultimate , Blu-ray Creator , Streaming Audio Recorder

dvd creator dvdsoft dvd soft iTunes movies to DVD mp4 to dvd burn mp4 to dvd convert mp4 to dvd mov to dvd wmv to dvd m4v to dvd mkv to dvd vuze to dvd torrent to dvd remove drm protection remove drm from itunes remove drm from bbc iplayer remove drm from amazon unbox remove drm from wmv drm removal tool dvd video tool itunes to kindle fire convert videos to iphone 4s
pylxwzhj

Posts: 719
Registered: 10/15/11
Re: Getting started with JPA/EJB3
Posted: Nov 17, 2011 2:45 AM   in response to: jkario in response to: jkario
 
  Click to reply to this thread Reply
China voiced

Coach Factory Outlet

misgivings about Obama's announcement

Coach Factory Store

of a de facto military base in Australia a

Coach Outlet

nd has longstanding fears that its growing power could be hobbled by U.S. influence.
Obama ac

Coach Outlet

knowledged China's unease at what it sees as attempts by

Coach Outlet Online

Washington to encircle it,

Coach Outlet

pledging to seek greater cooperation with Beijing.
The U.S. military,

Coach Outlet Online

turning its focus away from Iraq and Afghanistan, would be more broadly distributed in Asia, particularly Southeast Asia, more flexible and help build regional

Chanel Outlet

capacity, he told the Australian parliament.
"As we end today'

Chanel Outlet

s wars, I have directed my national security team to

Louis Vuitton Outlet

make our presence and missions in the Asia Pacific a top priority," Obama said in a major speech on Washington's vision for the Asia-Pacific region.
clothworld

Posts: 1,130
Registered: 11/16/11
Canada Goose UK
Posted: Nov 23, 2011 9:21 PM   in response to: jkario in response to: jkario
 
  Click to reply to this thread Reply
Body's feeling already completely could not Canada Goose Jackets remember now, for instance Canada Goose Canada is leads that back Must have the silver Canada Goose Coats hair is elegant, that body clothes YY, that stature is perfect, that sound is passing the invincible boldness in relaxing, as Canada Goose Sale soon as well as that Canada Goose Jakke raises hand controlling the forces of nature the startled world indescribably tragic Has the impression is only in Comrade Safi Ross just Canada Goose Toronto came out as soon as time that Canada Goose Online catches the eye a smile, then “disappears for a long time, Chrowder”, at Canada Goose Snow Mantra Parka that time completely overthrew me, that is the what kind strength pulls out Canada Goose Youth Parka thousand honored imposing manner (to speak of here certainly to Canada Goose Expedition Parka complain one.Finally Safi Ross that “I, only Canada Goose Chilliwack Parka will not Canada Goose Gloves exist in the memory”, the eldest child, you “defeated” Certainly, I believe Canada Goose Womens Expedition Parka was likely plays greasily went back Must have the appearance which defeats Canada Goose Trillium Parka to be good, do not quickly vanish such has been also Canada Goose Solaris Parka graceful the such self-confident such electricity person
Truly, thought now, the Safi Ross's Canada Goose Jakke existence, to the CC master line and that “the responsibility Canada Goose Jakker and vainly hoped for” the Canada Goose Vest noble Canada Goose Trillium Parka subject says does not have the significance nearly. In CC, Canada Goose Solaris Parka although said “crisis” in Canada Goose Kvinder Jakke the meaning the Canada Goose DK Udsalg Canada Goose major part Canada Goose Handsker becomes Niebuhr Canada Goose Chilliwack Parka who is refers to Canada Goose Outlet the Heym event, but the essence says, besides last will almost hang Zach Si and Chrowder changed two person of future destiny actor's pay, Safi Canada Goose Yorkville Parka Ross was only a high-level dragon embroidered costume, moreover was, finished the actor's pay high-level Canada Goose Sne Mantra Parka dragon embroidered costume by “the sin”. Hero? Looks over CC, when has manifested the Safi Ross's hero? Only three times looks at him to begin, the Canada Goose Ungdom Parka first time is and two friends hits is playing, last time is and Canada Goose Tilbud Zach Si evil spirit Canada Goose Parka shakes the stove in Niebuhr the Heym “the counter-humanity” the fight, a Canada Goose Expedition Parka middle with great difficulty right enemy, but also symbolic Canada Goose Kvinders Expedition Parka three next two finished up.
In the Japanese-style knife, the Canada Goose UK ordinary knife also calls “to hit the knife” Canada Goose Parka the universal length below Canada Goose Outlet one meter, but “too knife” Canada Goose Womens Expedition Parka limit length generally also only then one meter about 56, if again long, is called “the wild too knife”. Canada Goose Snow Mantra Parka Canada Goose Men Chateau However, not only too the knife and the wild too Canada Goose Chilliwack Parka knife's difference and Canada Goose Clothing displays in the length, simultaneously also displays in Canada Goose Solaris Parka the proportion. The wild too knife is purely both Canada Goose Jacket hands knife, the hilt long and Canada Goose Expedition Parka the solid knife thick broad, after being similar to the enlargement hits the knife. But Canada Goose Youth Parka Safi Ross's orthodox school knife, although the length is Women Canada Goose Jacket astonishing, but the Canada Goose Gloves hilt length actually only then 40 to 50 Canada Goose Trillium Parka centimeters, knife's width merely three centimeters about Canada Goose Yorkville Parka thickness only then several millimeters, a Canada Goose Sale time as if silver wire which looked far, but Safi Ross takes knife's time, the most time is brandishes a sword single-handed, therefore the orthodox school knife regulations belonged “lengthened the knife edge knife too”, but was not the wild too knife.
pylxwzhj

Posts: 719
Registered: 10/15/11
Re: Getting started with JPA/EJB3
Posted: Nov 26, 2011 3:03 AM   in response to: jkario in response to: jkario
 
  Click to reply to this thread Reply
The generals, meanwhile,

Coach Outlet

issued an unusual apology for the

Chanel Handbags

deaths of at least 38 people

Coach Outlet

during the week of unrest

Chanel Bags

and the injuries of more than 2,000.

Coach Factory Outlet

But even as they hailed the dead

Coach Outlet Online

as “martyrs,” the generals also appeared

Coach Outlet

to justify killing them as criminals

Coach Outlet

who had attacked the Interior Ministry.

Coach Outlet Online

And they denied — despite the statements

Louis Vuitton Bags

of many witnesses, doctors and

Coach Factory Outlet

even the health ministry — that security

Louis Vuitton Bags

forces had fired live ammunition or birdshot in

Coach Outlet

their clashes with protesters, further inflaming anger.
pylxwzhj

Posts: 719
Registered: 10/15/11
Re: Getting started with JPA/EJB3
Posted: Nov 26, 2011 3:29 AM   in response to: jkario in response to: jkario
 
  Click to reply to this thread Reply
The generals, meanwhile,

Coach Outlet

issued an unusual apology for the

Chanel Handbags

deaths of at least 38 people

Coach Outlet

during the week of unrest

Chanel Bags

and the injuries of more than 2,000.

Coach Factory Outlet

But even as they hailed the dead

Coach Outlet Online

as “martyrs,” the generals also appeared

Coach Outlet

to justify killing them as criminals

Coach Outlet

who had attacked the Interior Ministry.

Coach Outlet Online

And they denied — despite the statements

Louis Vuitton Bags

of many witnesses, doctors and

Coach Factory Outlet

even the health ministry — that security

Louis Vuitton Bags

forces had fired live ammunition or birdshot in

Coach Outlet

their clashes with protesters, further inflaming anger.
xiao

Posts: 80
Registered: 11/18/11
cheap jordans
Posted: Nov 27, 2011 7:46 PM   in response to: jkario in response to: jkario
 
  Click to reply to this thread Reply
cheap jordans
ECCO casual fashion step Nike ACG Air Max Goadome VI GXT - Men's Brown to demonstrate the love of the latest autumn and winter series, star-studded field for a time, Classic Waterproof Oxfords Timberland Men's Shoes in the elegant atmosphere of the music against the backdrop of the brand's design accentuates style and unique qualities. Models are sometimes lively and confident, sometimes elegant and pleasant, NIKE Air air BW Men's Shoes - Grey White Black for the pursuit of life style and fashion taste to provide a variety of options. If the statistics from the 1999 line step by step, all New listing Louis Vuitton Men's high casual Shoe collection marathon participants love the journey, then the statistics will walk out onto the equivalent of 45 laps around the Earth.http://www.wholesale-onlineshops.com

clothworld

Posts: 1,130
Registered: 11/16/11
Re: Belstaff Jacken
Posted: Nov 27, 2011 8:01 PM   in response to: jkario in response to: jkario
 
  Click to reply to this thread Reply
Girl chrysanthemum tea in Belstaff Jacken this beautiful spring flowers unexpectedly Belstaff Lederjacke encountered the outskirts of discrete Belstaff Jacke sub-chapter applied for many years fiance, wanted to win this for the Belstaff Gangster master and servant is affectionate sister, Miss Bu excuse to get out, a couple of discrete years of nothing to fall back Passions, chrysanthemum tea sub-learned chapter assumes the chest, willing to temporarily BU family, peace of mind start off on a journey to Kyoto to Herren Jacke Belstaff visit sub-chapter test.The promotion type Caterpillar Boots soft article follows up frequently when Cat Boots the above several kind of soft Caterpillar UK articles are effective such soft article or is the direct coordinate promotion use, or is uses, buys the request to create the product falling short of demand, through competes psychological influence effect Mens Caterpillar Shoes many kinds of factors to urge you to have the purchase desire. The so-called event Cat Boots For Men news body, is seeks for one for the propaganda by the head, writes by media event's technique, lets the reader think that as if is the event which yesterday just occurred.
clothworld

Posts: 1,130
Registered: 11/16/11
Re:Columbia Sportswear
Posted: Nov 28, 2011 2:38 AM   in response to: jkario in response to: jkario
 
  Click to reply to this thread Reply
Lu Huadong indicated that Columbia Sportswear this school bus accident previous three Columbia Jackets days, the Qingyang Bureau of Education, the Columbia Outlet Zhengning County Bureau of Education discovered Mens Columbia 3 in 1 Jackets in the inspection, this kindergarten existence school bus Lovers Columbia Trousers overload situation, once ordered the kindergarten to carry on reorganizes. The Ministry Supra Shoes of Education requests the Supra Shoes UK regional Educational department and the elementary and middle schools Supra TK Society kindergarten; first, develops immediately to the elementary and middle school students and the baby leaves Womens Supra TK Society Shoes class rides in a carriage the security situation investigation. Must chase the school by to live by the garden leaves class the riding Womens Supra Skytop Shoes situation Supra Vaider to the student on to carry on the overall check understanding, rents the vehicles to the Supra Skytop III Shoes school and the kindergarten to carry on the New Supra Skytop Shoes security check, the existence safe hidden danger must stop using the service immediately; The Supra Strapped NS discovery has the guardian to rent the society the illegal operation vehicles to give to advise Supra TK Society Shoes against.
north face clea...

Posts: 21
Registered: 11/29/11
Re: Getting started with JPA/EJB3
Posted: Nov 29, 2011 1:28 AM   in response to: jkario in response to: jkario
 
  Click to reply to this thread Reply
Machinery key eternal can wholesale north face password the north face were can wholesale the north face clothing guess, but this special magic to do? everyone of magic are is different of. this north face wholesale on like is fingerprint as, fundamental found does not to full as of. like Ling such ofnorth face wholesale china can master to is can simulation out others of magic, just magic of type too north face jackets wholesale, one by one try words I'm afraid than that ten bit number ren tore tingli oxime north face jackets cheap benzyl said hanging? and both while correctly of possibilities, that on more without wanted to has, the North Try face in this life is unlikely to do.
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