Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6086355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:44:43+00:00 2026-05-23T11:44:43+00:00

There is a tutorial http://code.google.com/docreader/#p=morphia&s=morphia&t=QuickStart But it leaves out the detail how to get

  • 0

There is a tutorial

http://code.google.com/docreader/#p=morphia&s=morphia&t=QuickStart

But it leaves out the detail how to get the id of the hotel.

Morphia morphia = ...;
Datastore ds = morphia.createDatastore("testDB");

String hotelId = ...; // the ID of the hotel we want to load

// and then map it to our Hotel object
Hotel hotel = ds.get(Hotel.class, hotelId);

I thinks its either java driver for mongo or morphia API.
So how do I get the id?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:44:44+00:00Added an answer on May 23, 2026 at 11:44 am

    This is no different from how you would do it, say you were using a RDBMS.

    Let’s say you are building a travel site. Now you have a database which already has the hotels that are associated with the cities that they belong to.

    Now I as a user come in and request to be shown all the hotels, in, new York, then you would go to the database and query for all hotels that are in new York and then send back a list from your application, maybe rendered into a page and then display the results to the user. This results page, will at least have, the id thats in the database, and the hotel name. Now, once the user wants to see more details, say of The Waldorf hotel, they would click on that, and the I’d for that hotel would be passed back to your application. Now the code sample you have can be then used to load all the details of the hotel a Nd then display them to the user.

    Make sense?

    To summarize, the I’d of the record you want to load, typically comes from user input, where you load a list of Ida and the user can then select one or more. And to get the list of Ida, you typically query by some parameters, in the above case, by the city name.

    Now, to proceed with using the sample above, you can hard code the id, to a value that you already have in the db and complete the code.

    Another option, you can create a new instance of the hotel object and then issue the ave command like the docs say and then once you do that, if you have a property mapped as an ID, you can do a get on that property and then pass it along to the the note I’d, and then execute the read query.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've followed instructions http://code.google.com/webtoolkit/doc/latest/tutorial/gettingstarted.html in order to create sample GWT program. Now I would
I recently followed this tutorial on Google Cloud SQL and GWT: http://code.google.com/apis/sql/docs/developers_guide_java.html I deployed
I m trying to run the code given here - http://code.google.com/p/android-honeycomb-fragment-tutorial/source/browse/#svn%2Ftrunk%253Fstate%253Dclosed on a 7
I want to include Core Location and I'm trying to follow this tutorial: http://www.mobileorchard.com/hello-there-a-corelocation-tutorial/
Is there any good tutorial or code snippet out there on how to use
I'm following two tutorials from Google: http://code.google.com/apis/maps/articles/phpsqlgeocode.html http://code.google.com/apis/maps/articles/phpsqlajax_v3.html#createmap I have the first tutorial working
The following code is from a tutorial ( http://net.tutsplus.com/php/creating-a-php5-framework-part-1/ ), not mine. I have
I am following a tutorial on http://msdn.microsoft.com/en-us/wp7trainingcourse_usingbingmapslab_topic3#_Toc271039355 . Source code can be found here:
Using Xml to parse an XML document in Google Apps Script : http://code.google.com/googleapps/appsscript/articles/XML_tutorial.html#HowItWorks But
I am trying to integrate the code from this demo: http://code.google.com/p/gwt-spring-starter-app/ into my main

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.