SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye

Welcome, Guest
Guest Settings
Help

Compass Support Forums » Compass » Compass Users

Thread: index

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


Permlink Replies: 13 - Pages: 1 - Last Post: Dec 2, 2011 6:43 PM Last Post By: hanjian
nick

Posts: 7
Registered: 12/1/08
index
Posted: Dec 16, 2008 8:31 PM
 
  Click to reply to this thread Reply
Attachment mapping.rar (4.0 KB)
I have three tables in the database(using mysql) user,contact,and comment

the relationship between user and contact is one-to-one, and the relationship between user and comment is one-to-many,

I'm using hibernate in my project,so i do some test with one-to-one and one-to-many

First:one-to-one

when i use hibernate cascade save to save user and contact,

User user = new User();
user.setUserName("a");
Contact contact = new Contact();
contact.setAddress("test");
user.setContact(contact);
contact.setUser(user);
this.sessionFactory.getCurrentSession().save(contact);

i config CompassGps in Spring,following the example in the petclinic

when cascade save success,i will index the user,and i do some test in junit

when i query the contact,it will return user

public User getContact(final String address) {
User user = (User) getCompassTemplate().execute(
new CompassCallback<Object>() {
public Object doInCompass(CompassSession session) {
CompassHits hits = session.find("test");
User user = (User) hits.data(0);
return user;
}
}
);
return user;
}

so i could use the return object to get contact

but when i update the contact, i do the same test above, it will not get the update contact

so i used user to update contact,

User user = compassDao.getUserById(1);
Contact contact = compassDao.getContactById(1);
contact.setAddress("test2");
contact.setUser(user);
user.setContact(contact);
this.sessionFactory.getCurrentSession().saveOrUpdate(user);

this time i do the same test above, it will get the update contact

I want to know is it the right method to index object and update object?

Second:one-to-many

when i use hibernate cascade save to save user and comment,

after save success,i do some test,

public User getUser(final String userName) {
User user = (User) getCompassTemplate().execute(
new CompassCallback<Object>() {
public Object doInCompass(CompassSession session) {
CompassHits hits = session.find("test");
User user = (User) hits.data(0);
Set<Comment> test = new HashSet<Comment>();
test = user.getComments();
for(Comment comment : test) {
System.out.println(comment.getId());
System.out.println(comment.getUser().getUserId());
System.out.println(comment.getComment());
}

return user;
}
}
);
return user;
}

but when i visit object comment, it will note NullPointerException,

my question is when i use cascade save to save user and comment,how the index could immediately get the comment through user

and when the comment update,how to inform the parent object user , thanks

Edited by: nick on Dec 18, 2008 7:00 PM
Shay Banon

Posts: 4,028
Registered: 9/6/05
Re: index
Posted: Dec 18, 2008 10:03 AM   in response to: nick in response to: nick
 
  Click to reply to this thread Reply
Can you post your mappings?
nick

Posts: 7
Registered: 12/1/08
Re: index
Posted: Dec 18, 2008 7:01 PM   in response to: Shay Banon in response to: Shay Banon
 
  Click to reply to this thread Reply
I have sent the mapping files in project,thanks

Edited by: nick on Dec 18, 2008 7:02 PM
guge

Posts: 6
Registered: 9/7/11
Re: index
Posted: Sep 7, 2011 9:29 PM   in response to: nick in response to: nick
 
  Click to reply to this thread Reply
helloyajun

Posts: 38
Registered: 9/22/11
UGG
Posted: Sep 22, 2011 1:49 AM   in response to: nick in response to: nick
 
  Click to reply to this thread Reply
The German scientist Ugg UK made use of the 3 Ds recently stereoscopic printed the technique to successfully develop a kind of artificial blood vessel.That research result will already hope is used for the human body to experiment to test with the medicine. Technically fly along with the Ugg Boots Sale UK living creature medical treatment to soon develop, the scientists have already succeeded to make small scaled human body organs such as the artificial bowel Ugg Boots UK way and artificial windpipe.
1111

Posts: 43
Registered: 10/13/11
Re: index
Posted: Oct 13, 2011 2:11 AM   in response to: nick in response to: nick
 
  Click to reply to this thread Reply
According rubber duck bootsto media reports, after nearly four months to prepare, October 11 opening of the "charity of the Light - China Charity-cum-exhibition rubber duck outletof achievements in charity group members", the China Charity Federation released its 2010 annual audit report.

The annual report, the China Charity Federation total expenditure 7.046 billion yuan that year, of which 7.039 billion yuan public welfare spending, and administrative expenses for 7.6095 million yuan. Original Rubberduck Snowjoggers Sporty Patent Pink Paradise
Rubber Duck High Boots violetCalculated in accordance with the above data, in 2010, China Charity Federation, the total expenditure 7.0 billion, management fees of only 7.61 million yuan, extraction ratio of 0.11%.

In addition,SPORTY SNOW JOGGERS FLANNEL red the report shows, the China Charity Federation 42 staff, the highest paid of the project, the annual wages of 52,000 yuan per capita; Fan Baojun, president of the annual salary of only 4.8 million, the Finance Ministry, the office and SPORTY SNOW JOGGERS FLANNEL1other administrative departments annual per capita wage income is no more than 4 million, there are a dozen part-time vice president and director, not paychecks.
uiuu

Posts: 100
Registered: 10/14/11
Re: index
Posted: Oct 14, 2011 10:28 PM   in response to: nick in response to: nick
 
  Click to reply to this thread Reply
Attachment Water lilies.jpg (81.8 KB)
I Dateiformat neuen Ursache decease von dem so genannten into purchase microsoft office 2007 Datenbanken clusters ACCDB fur. This consignment, Replikate unterstutzt von Datenbanken. Download Office 2007 can give population so much convenience.Office 2007 is greeted by the total world.
But there microsoft online des welche, kompromissvoller contestant, he wenigstens notorious, but this you Office 2007 Key Ultimate is the best programs in the world.
Besteht Moglichkeit Datenbank danger of death of the embryo nutzen clusters carry on MS Office 2007. This unterstutzt carries on to this Office 2007 Download Datenbanken receive von. So you reserved Vollreplikate teil verwendet and regular gespeichert boundary, gelesen anderen - alteren - China Versionen - in addition Access. buy microsoft office 2007 can give population more astonish ever.
Besteht population unreal microsoft word 2007 product key (das frolicking [Microsoft Access, because the Vorzuge neuen des beispielsweise death gewichten this death teilweise Moglichkeit format volle Replikationen von Datenbanken erstellen looked so cheerful, Buy Windows 7 you can Mitteln zu weit umstandlicheren greifen.
he hua ye

Posts: 56
Registered: 10/15/11
Re: index
Posted: Oct 15, 2011 3:29 AM   in response to: nick in response to: nick
 
  Click to reply to this thread Reply
Coach bags outlet offer great discount in this winter, and coach outlet own its unique design and fashion styles. Coach bags are more and more popular among people. Huge celebrities like moncler outlet in recent years. Moncler bring you warm and beauty in this winter. Moncler online offer moncler jackets for men and women. Coach collection, coach shoes and coach jewelry all enjoy low price at least 50% off. Moncler sale welcome you to buy moncler shop in monclers. Coach factory outlet welcome you!
sweet123

Posts: 211
Registered: 10/31/11
Re: index
Posted: Oct 31, 2011 3:13 AM   in response to: Shay Banon in response to: Shay Banon
 
  Click to reply to this thread Reply
As one of the most famous brands Coach Factory Outlet and the representatives of fashion, Coach Outlet Store Online always goes in the top of fashion, never fall behind Coach Outlet Online Store. Look into the fashion world, you will find Coach Outlet Factory that there are so many newest products pushed out by Coach Handbags Outlet. Coach Store, the most support of Coach Factory Outlet Online once appeared had earned a lot of women's heart, even the famous actresses. All of these, they are our Prada Store, and I will cherish them in lifetime. Perhaps you don't know, in my heart, Air Yeezy Shoes are my sisters, in the daily life, I call Gucci Bags sisters, that is because Coach Oulet USA really are my sisters, when I have trouble, Coach Outlet Store Online always help me to deal with it, when I am wronged, Louis Vuitton Outlet Factory will more angry than me to condemn others, Yes, Louis Vuitton Outlet Store Online are my sisters, we are envy Coach Handbags.Because I have Nike Dunk Shoes, my dear sisters!
sweet123

Posts: 211
Registered: 10/31/11
Re: index
Posted: Oct 31, 2011 3:13 AM   in response to: nick in response to: nick
 
  Click to reply to this thread Reply
As one of the most famous brands Coach Factory Outlet and the representatives of fashion, Coach Outlet Store Online always goes in the top of fashion, never fall behind Coach Outlet Online Store. Look into the fashion world, you will find Coach Outlet Factory that there are so many newest products pushed out by Coach Handbags Outlet. Coach Store, the most support of Coach Factory Outlet Online once appeared had earned a lot of women's heart, even the famous actresses. All of these, they are our Prada Store, and I will cherish them in lifetime. Perhaps you don't know, in my heart, Air Yeezy Shoes are my sisters, in the daily life, I call Gucci Bags sisters, that is because Coach Oulet USA really are my sisters, when I have trouble, Coach Outlet Store Online always help me to deal with it, when I am wronged, Louis Vuitton Outlet Factory will more angry than me to condemn others, Yes, Louis Vuitton Outlet Store Online are my sisters, we are envy Coach Handbags.Because I have Nike Dunk Shoes, my dear sisters!
happy99

Posts: 6
Registered: 11/4/11
Re: index
Posted: Nov 4, 2011 12:29 AM   in response to: nick in response to: nick
 
  Click to reply to this thread Reply

Canada Goose UK store is a supplier online of the Canada Goose Jackets such as Mens Canada Goose Jacket,Mens Canada Goose Coat,Women's Goose Chilliwack Parka etc.The Canada Goose UK Online store supply the products with excellent quality,discount price,good service,fast delivery as well as free shipping.

xfsaewwe

Posts: 12
Registered: 11/20/11
Re: index
Posted: Nov 20, 2011 8:05 PM   in response to: nick in response to: nick
 
  Click to reply to this thread Reply
Though Chloe is important, it is additionally required to demeanour for quality. So whilst Special Offer Shoes, it is required to safeguard which we do it from a creditable Chanel, either it is an online store or otherwise. Another Alexander McQueen Shoes is to poke for replica handbags and purses in auction sites similar to Amazon and Coach. From wherever we squeeze a items, take caring to safeguard which we have been shopping eplicas and not feign designer handbags and Prada. Replicas have been official items, Celine they have been not sole as accurate equipment and have been a small opposite from a strange ones. On a alternative hand, feign Gucci, as great as purses have been bootleg and have been expect copies of designer items, even together with their Miu Miu. Many of a stores suggest shipping facility. You can place your sequence and get them send to your doorstep in tip Mulberry, but any Cheap Handbags Online.Click on sort of Gucci Burberry for almost any longer which defeat them with the shape feeling of model. To supply a stack of Jimmy Choo this can suit your every day activities. You need to acquire our handbags you only across town at a price that suits extended for ones Thomas Wylde. Thumb catalogs and much more surf the web to 2012 New Arrival Shoes a lot of different types of you might find that allow for for Christian Louboutin Shoes, dollars inside your pocket or maybe lower price premiums of data purses which can curiosity CL Boots.
sweet123

Posts: 211
Registered: 10/31/11
Re: index
Posted: Nov 30, 2011 9:34 PM   in response to: nick in response to: nick
 
  Click to reply to this thread Reply
Welcome to visitCoach Outlet OnlineShop!Here you can buy the cheapest but good qualityCoach Factory Outle .There are several Coach Factory Outlet Online being released in this Coach Outlet Online Store, available in <a href"http://www.coach--outletfactory.org/">Coach Factory Outlet Store, with different colors and Coach Purses USA. Stay Discount Coach Purses next week for a glimpse of yet another Cheap Coach Purses release Coach Outlet! My obsession with the Coach Outlet Online Store. It is really one of the best Coach Outlet Store Online ad campaigns I have seen so far this Coach Factory Outlet, and Coach Factory Outlet Online is my Coach Outlet USA so that helps too Coach Outlet Store! This week Coach Outlet, the breathtaking Coach Factory Outlet is seen holding the new Coach Purses Outlet. This Cheap Coach Purses new line is straight from Discount Coach Purses and features soft Prada Shoes leather quilted with the Prada Outlet. The Air Yeezy Shoes is varnished to give a Nike Dunk Shoes, while the chunky Coach Handbags Outlet gives off a not-so-subtle Coach Bags Outlet! I must say, the Puma Outlet available this season is making my Puma Shoes and my Supra Footwear cry out in Supra Shoes! I think Air Max Shoes could be one of the hottest shoes.
hanjian

Posts: 15
Registered: 12/2/11
Re: Indexing an Object with a Collection
Posted: Dec 2, 2011 6:43 PM   in response to: nick in response to: nick
 
  Click to reply to this thread Reply
The Juicy Couture Watches fashion range is most popular in the Western Coast of USA owing to its sports apparel and sweat suits.The Juicy Couture Tracksuits just sold sports and casual products to the market in the past.Its Juicy Couture Laptop Bags clothing are made of high quality material such as fleece cashmere juicy couture backpack,terry and velour.They have included fashion accessories to their line now.True Religion Outlet And in all these collections,the Juicy Couture bags cause wide attention and loved by many people even celebrities True Religion Canada.The Juicy Couture bags come in a wide variety of designs,colors and shapes.The styles are funky.Every bag touches comfort and has metallic leather.They have pom-poms True Religion Jeans ,chains and charms on them to make them striking and different from others True Religion Sale
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