Ok, These are all basic questions but there are not many answers found on the Internet.
OK, Now, I insert into Datastore using this Java code
Text descriptionText=new Text(description);
structureEntity.setUnindexedProperty("Description",descriptionText);
Anh here is the retrieving code:
Text description=(Text)structureObjectEntity.getProperty("Description");\
System.out.println(description);
Now, let say, I insert "We should arrive before dark.<br>I should have finished the book by Friday. <br>The roads should be less crowded today.<br><br>Source: http://www.oxfordlearnersdictionaries.com/definition/english/should?q=should
" into Datastore
But when retrieving data, the System.out.println(description);
return <Text: We should arrive before dark.<br>I should have finished the book by Fr...>
(some data got lost & there is <Text:
at the head of the data & ...
at the tail of the data) & that messed up everything.
So, How to retrieve Text type from Datastore Google Cloud?
You need to call the
getValue()
method. If you pass theText
object toprintln()
it will call thetoString()
method. Here are the Javadocs