since my new project has to use toplink-essentials which only supports jpa 1, I'm looking for some good jpa-utilities. So far I only worked with jpa 2 (both EclipseLink and Hibernate), which didn't need any utilities to write dynamic queries in 99% of the time.
Now I'm stuck with jpa 1 and wondered if there were some utilities/libraries which could support me in writing my queries a little bit more dynamically.
Jonny
TopLink Essentials does support Expression queries which are similar to JPA 2 Criteria. You may be able to use them.
You should also be able to upgrade your server to EclipseLink.
Related
I have a small project with inherited C# code, specifically Entity Framework Core. This is hosted in Azure and recently I saw a very interesting feature that I would like to try out: "Automatic Tuning" for the database.
I have a couple of questions regarding this:
Would it conflict with my Entity Framework, as the database objects were originally created from code? My understanding is that it shouldn't, but I would like to be sure.
Is it worth it or anyone had any trouble with it?
Thanks!
Automatic Tuning does not get in conflict in any way with Entity Framework (EF). It just create indexes needed by queries in use on your application. It also drops duplicated and unneeded indexes (but existent unique indexes are not dropped) and chooses the best query plan created by SQL Server. None of these are related to EF.
One thing you need to consider is that Azure SQL Database needs to monitor query activities at least for a day in order to identify some recommendations.
Another thing to take in consideration is that Automatic Tuning does not update statistics and does not defrag indexes.
Could someone give me an explanation of if what I'm doing makes sense?
I am currently developing a Java EE application using MVC architecture, and MongoDB as my database. What I have is several entities written as Java objects with custom mapping methods to persist to and from my MongoDB, as well as a separate controller class to perform Database queries and operations. I am able to store these entities in my session with no problem, but I haven't tested this on a larger scale. I've tried annotating my objects as beans, however I received errors.
My typical method of transmitting data is to query my MongoDB, receive the information, map it to a java object, and store it in a session to be accessed by the front end. Is this the proper way to go about this?
Do my entities need to be EJBs? What do I have to gain from making them EJBs? I'm sorry if this question is presented poorly and seems unintelligent. I just want to have a better understanding of the technology I am trying to utilize before further developing. Most of the reading I have done on such topics has been to no avail. If anyone has some clear reading or an explanation that should help me understand what I am asking, it would be most appreciated.
I assume by "EJBs", you are referring to "Entity Beans"? In EJB 3, entity beans are "replaced" by JPA. Think of JPA as a "specification" for ORM frameworks. JPA/ORM are frameworks for mapping Java objects to and from relational databases. You are using MongoDB, which is not a relational database, and hence not that suitable for JPA. So I would say no, there is no need for you to consider JPA. Instead you should consider other frameworks, like Spring Data, which can simplify the task you are doing.
in my opinion you can use EJB3 with mongodb without JPA and entity manager, but you will have Stateless/Singleton/Startup/MDB beans with 0 configuration and with perfect managable backend.
SQL Server 2012 introduces a more efficient mechanism for paging using FETCH and OFFSET which could have a big impact on performance of apps which use a lot of paging. Does Entity Framework 5 support this?
So if Im using EF to page using Take + Skip will the LINQ queries be translated into the new 2012 TSQL if EF is targeting SQL Server 2012?
As #Ladislav said, EF 5 doesn't support OFFSET & FETCH. With that said, I wanted to add a bit of perspective. I don't think it should matter much.
When you buy into an ORM like Entity Framework, you're out sourcing your query generation (for perfectly valid reasons). Whether EF uses the 'older' CTE style query with Row_Number() or the newer Fetch / Offset is an implementation detail. Microsoft could update the EF code at any point and change the query generation to use one or the other.
If you want control over the query generation, you either:
Use EF's 'stored procedure mapping' ability
Use stored procedures directly with EF (something I do quite often)
write the ADO/SQL yourself, or
use a more limited micro-orm like massive/PetaPoco
So does it matter?
Well, to a developer writing queries the new syntax is going to be a welcome relief. On the other hand, it doesn't appear that there is a real performance difference between the old CTE method and the new syntax. So from EF's perspective -- not really. We incur a significant overhead using EF, the method of paging probably won't be your break point.
EF 5 doesn't support this feature - actually I think none of SQL Serve 2012 features is available in EF. You can vote for this feature on Data UserVoice to move it up in ADO.NET team product backlog.
We are using FluentMongo and now that LINQ support has been added into the C# driver, we are going to remove the dependency on Fluent and go with the official C# driver alone.
Has anyone done this already, and was it simple and straightforward? Is there anything we need to be looking out for?
Hopefully others will report back to you as well, but as the implementer of the LINQ support in the 1.4 C# driver I can tell you a bit about what to expect.
Overall you can expect some features to be missing and some new ones to be present. One difference is that the official C# driver only supports LINQ queries that can be mapped to reasonably equivalent MongoDB queries. The FluentMongo library would handle some LINQ queries that didn't have MongoDB equivalent queries with techniques like building Javascript where clauses or dynamically building map/reduce jobs. The official C# driver is not going to do that, because we don't want deceptively simple looking LINQ queries to have unexpectedly inefficient implementations.
In the future we are looking at mapping certain types of LINQ queries onto the new aggregation framework coming in the 2.2. release of the server.
If you run into any issues porting to the 1.4 C# driver please report them at https://jira.mongodb.org/browse/CSHARP and we will look at them as quickly as possible.
I have recently started getting familiarized with NoSQL (HBase). I am definitely a noob.
I was investigating about ORMs and high level clients which can be used on HBase and came across a few.
Some ORM libraries like Kundera are providing SQL like data query functionality. I am finding this a little counter intuitive.
Can any one help me understand why we would again need SQL like querying if the whole objective was to move away from it?
Also can anyone comment on your experiences with ORMs for HBase? I looked at a few of them from http://wiki.apache.org/hadoop/SupportingProjects and started looking at Kundera.
Another related question - Does data query with Kundera run map reduce jobs internally?
kundera or Spring data might provide user friendly ORM layer over NoSQL databases, but the underlying entity model still has to be NoSQL friendly. This means that NoSQL users should not blindly follow RDBMS modeling strategies but design ORM entities in such a way so that all NoSQL capabilities can be used.
As a thumb rule, the kundera ORM entities should be designed using query-first strategy where first the queries need to defined so as to create primary keys and also ensuring that relationship model is used as minimal as possible. Querying on random columns and full scans should be avoided and so data might have to be replicated across entities for reducing multiple entity look ups. Also, transactions management needs to be planned. FYI, kundera does not support transactions(beyond single row TX supported by Hbase/Cassandra).
Reason for using Kundera:
1) If looking for SQL like support over HBase. As it is build on top of HBase native API, so it simply transforms these SQL queries in to corresponding GET or PUT method calls.
2) Currently it support HBase-0.20.6 only. Kundera-2.0.6 will enable support for HBase 0-90.x versions.
3) Kundera does not do sometihng out of the box to provide map reduce over SQL like queries. However support for such thing will be provided in Kundera-2.0.6 by enabling support for Hive native queries only!
It is totally JPA compliant, so no need to learn something new. It simply hides complexity at developer level with very minimal effort.
SQL like querying is for developement ease, quick developement, less error prone and reusability ofcourse!
-Vivek