persistence

How to find the closest point in the DB using objectify-appengine

别来无恙 提交于 2020-01-15 07:21:01
问题 I'm using objectify-appengine in my app. In the DB I store latitude & longitude of places. at some point I'd like to find the closest place (from the DB) to a specific point. As far as i understood i can't perform regular SQL-like queries. So my question is how can it be done in the best way? 回答1: You should take a look at GeoModel, which enables Geospatial Queries with Google App Engine. Update: Let's assume that you have in your Objectify annotated model class, a GeoPt property called

How to find the closest point in the DB using objectify-appengine

拥有回忆 提交于 2020-01-15 07:20:06
问题 I'm using objectify-appengine in my app. In the DB I store latitude & longitude of places. at some point I'd like to find the closest place (from the DB) to a specific point. As far as i understood i can't perform regular SQL-like queries. So my question is how can it be done in the best way? 回答1: You should take a look at GeoModel, which enables Geospatial Queries with Google App Engine. Update: Let's assume that you have in your Objectify annotated model class, a GeoPt property called

How to map query for iBATIS with parameterized column in select clause?

房东的猫 提交于 2020-01-14 18:58:19
问题 I want to have a method that finds a certain value from a column of a particular table in the database, where the name of the column is passed in as a parameter. So the Java method would have the following signature: public Integer getFoo(String column) throws DataAccessException; My attempted mapping for this query is the following: <select id="getFoo" parameterClass="java.lang.String" resultClass="java.lang.Integer"> select min($column$) from daily_statistics where $column$ > 0 </select>

Hibernate not saving collection of values

被刻印的时光 ゝ 提交于 2020-01-14 12:54:07
问题 Okay, I've used Hibernate in several projects now but I did not learn its intricacies before using it. I started with looking at codes that used JPA Annotations and integrated with Spring and everything worked well. But now that I want to teach basic Hibernate to my students and I'm in the process of creating an example and using the documentation tutorial Chapter 1, I'm having a problem with saving a Set of collection values in one persistent class. Here's the persistent class... public

OpenJPA 2.1.1 - Cannot find the declaration of element 'persistence'

若如初见. 提交于 2020-01-14 10:32:39
问题 I just downloaded http://www.apache.org/dyn/closer.cgi/openejb/4.0.0-beta-1/apache-tomee-1.0.0-beta-1-webprofile.zip to use OpenEJB with OpenJPA2.1.1. I can't get my persistence.xml working. The top of the stack trace: org.xml.sax.SAXException: file:/D:/Workspaces/sandbox/tomcat_ejb_jpa2_tomEE/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testEE/WEB-INF/classes/META-INF/persistence.xml [Location: Line: 2, C: 248]: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the

Is there a C# analogue of java.util.Properties class

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-14 08:53:45
问题 Java has a Properties class that is nice for saving basic configuration information, e.g. a gui setting you would like to have persist from one session to the next. It saves and retrieves key value pairs as I recall and is quite simple to use. I have been looking for an analogue of this in C# but without success. Am I missing it? If there isn't one, is there anything above and beyond simply saving / reading a custrom text file for saving simple application setting? (Measure of "above and

Is this correct (better) object relational mapping?

亡梦爱人 提交于 2020-01-14 04:07:26
问题 I have really got stuck with using Hibernate in my project. Some issues I have described here: Hibernate: getting too many rows I have started wondering if my code is correct. I am working on a huge project and I have had to define mapping classes with annotations on my own. But when the problems have began to occur I have decided to recreate part of database separate to the project and try to generate entities in IDE. I have two tables: My and Option . My has primary key: column qwerty and

Hibernate Query to fetch records on date ignoring timestamp

柔情痞子 提交于 2020-01-13 19:31:08
问题 I have a timestamp column tradedate in one of the DB(Oracle) tables. I am using hibernate as the persistence layer to fetch and store Data to DB. I have a requirement in which I need to query the DB on date. i.e From UI the user passes a date and I need to get the filtered data based on this date. If the tradedate column only has the date part my query returns the correct records The issue arises when the tradedate column is populated with a timestamp value ie(date + time). Then those values

Issue with NSSearchPathForDirectoriesInDomains And Persistent Data

▼魔方 西西 提交于 2020-01-13 05:43:09
问题 As suggested, we're using the following code to retrieve the user document's path NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; we get the following path as as result: /var/mobile/Applications/3E3C1F45-6649-4EA3-93FD-CDB802E346EC/Documents/ In said path, we save all the user's persistent data. We encountered some problem with users who upgraded the application's version from the app

Oracle thin driver vs. OCI driver. Pros and Cons?

南笙酒味 提交于 2020-01-12 12:07:30
问题 When you develop a Java application that talks to oracle DBs, there are 2 options right? One is oracle thin driver, and the other is OCI driver that requires its own installation (please correct if I'm misunderstanding). Now, what are the pros and cons? Obviously thin driver sounds much better in terms of installation, but is there anything that OCI can and the thin one can't? Develop environment is Tomcat6 + Spring 3.0 + JPA(Hibernate) + apache-DBCP 回答1: The choice of the driver depends