entity

Fetching the nth element from app engine datastore

I'm looking for a effective and scalable way of doing the following with the java low level API. I have a query with some sort orders and i would like to fetch the Nth entity. Using the offset argument doesn't seem like a good idea. EDIT Background: I'm trying to write an abstraction layer for DS with a Memcache. The data stored in the ...

POCO valuetypes in ENtity Framework

I am using POCO types for my model. It is working perfectly but for Value Types (not nullable) like int or boolean, i am not able to change values to default. If boolean property is set to True i can't change it to false. Same is true about Int i cant change it to 0, other values working perfectly. It works fine for Nullable types. ...

Best way to share Java implementation between concrete JPA classes?

I have about 10 different entities in my J2EE application that right now share the exact same implementation. They all inherit from the same generic abstract class that has been annotated as a @MappedSuperclass, but this class contains none of the implementation I have repeated in all the concrete subclasses. If I could, I'd put all...

How can I keep an observable collection sorted in a listbox?

I have the following to get data from an Entity Framework 4: IQueryable<Exam> examsQuery = entities.CreateQuery<Exam>("[Exams]").Include("Course"); exams = new EntityObservableCollection<Exam>(entities, "Exams", examsQuery); In my viewmodel I have the following code: public IEnumerable<Exam> Exams { get { return exams; } } ...

Entity Framework Class with Extra Field

Hi, im working with Entity Framework, SQL and C#. I have a table on SQL called Clients. I have to show the clients on a Grid in a Form and select some of the clients using a Check. So, i need 1 check for each client on the grid. I try with "Anonymous Types" but this are ReadOnly properties and i need ReadWrite properties. It is possi...

Hibernate and Serializable Entities

Does anyone know if there is a framework out there that is able to strip out Hibernate collections from entity classes to make them serializable? I had a look at BeanLib but it only seems to do deep copies of entities while not allowing me to specify implementation mappings for the collection types in my entity classes. BeanLib currently...

Unable to add foreign keys manually in Entity Framework 4

So I have a sql server 2008 database with 9 tables in them, they don't have any set relationships but is still used as if they have it, this however makes it so that I cant import the relationships when importing the models from the database. Now, when trying to add an association between two tables work but when I want to point tb1.Id ...

linq2sql: how to modify not-mapped entity member in query?

How to modidy entity in query? I have code like this: var res = from p in dc.Folders group p by p.FolderId into gr let DDate = gr.Where(a =>a.status ==5).Max(g=>g.MDate) from c in gr select c; Folder class has extra member not mapped to db called DDDate, just for example. How I can set this memb...

Can i get entity filled via Entity SQL ?

Hi. Can i do something like that: I got some entity Customer with Id, Name, Comment Now i want to get this entity from context with filled id and Name and Comment must be empty. I don't want to query it from database. in T-SQL it simply: Select Id, Name from Customers where id=4 Can i do that trick with Entity SQL something like th...

Expression and Parameter

I have this method: public static Expression<Func<MyEntity, bool>> MyMethod(string someId) { return o => o.SomeProperty.Equals(someId); } This is being passed to another method that uses entity framework with this expression to retrieve the matching items. My problem is it doesn't work. If I replace the someId as part ...

How to get a list of EntityObject's from an EF model

I need to be able to iterate of a list of EntityObjects that are in an EF model. For Example.. foreach (System.Data.Objects.DataClasses.EntityObject eObject in ????) { } From what I can see the model context has no such public enumerator. Anyone ever done this? ...

Unable to cast the type 'System.String' to type 'System.Object'. LINQ to Entities only supports casting Entity Data Model primitive types.

I am using EF 4 but it is giving me error when I try to order my list. Unable to cast the type 'System.String' to type 'System.Object'. LINQ to Entities only supports casting Entity Data Model primitive types. This is my code to get the experssion by entering the property name, example below get the Customer Name var param = ...

Entity Framework getting attribute/value pairs.

I'm working with an existing database, utilizing the Entity Framework for dynamic query builder. This is a key factor here. I don't know what types of objects I'll be working with until runtime, as the user is allowed to select which objects/properties they want with the query builder... So I'm using ObjectQuery<EntityObject>. Everythin...

Self tracking entities return Unchanged in my WCF service

I've set up a little n-tier web application using MVP (Model View Presenter) in the front-end, a WCF service on the backend, which communicates with the BLL an behind that the DAL, which communicates with the EF4.0. This is all working quite nicely, I've created several Get and Add methods which all work. Now I wanted to create several ...

question regarding mulitple entityManagerFactory in Spring 2.5.6

I am using Spring+JPA+Hibernate in my application. The issue I am facing is that I have multiple databases in my application and I have configured them correctly(I think) in the applicationContext.xml. Please refer to my applicationContext.xml below and tell me if: That's how I am supposed to configure the multiple databases If yes h...

Spring 3 Forms + ModelAttribute + Deteched Entity

When saving an entity using Spring Forms and Hibernate I use the following controller method (simplified) to do that. @Transactional @RequestMapping(value="/speichern", method = RequestMethod.POST) public void saveEvent(final @ModelAttribute("__eventData") MDKEvent p_event) { em.persist(p_event); } // saveEvent When I try to edit...

Hibernate - a different object with the same identifier value was already associated with the session

After changing the @id of a Entity from @Id private int getId(){ return this.id; } to @Id private String getLogin(){ return this.login; } I get the error: a different object with the same identifier value was already associated with the session In the webapplication isn't changed anything. A read the entity and then ch...

Can ObjectQuery.OrderBy() use NEWID() ??

Hi there, I found that Entity SQL support NEWID(), but does ObjectQuery support it as well? http://msdn.microsoft.com/en-us/library/bb738616.aspx, Can I write objectquery like: context.member.orderby("NEWID()").select("it.UserID"); or something like this? or I should write in other way? I thought if entity sql support NEWID() func...

Encrypted columns with Entity Framework

Anyone figured out a good way to pull encrypted values from db through entity framework 4? I got a MySql db with some columns encrypted with des_encrypt and need to be able to get those values as easy as possible, and also of course, update and insert them. I think it's quite strange there doesn't seem to be in built support for this i...

Format DateTime in an EF query

I have a database table that holds information for received files. One of the columns is a DateTime that specifies when the file was received. I need to get a distinct list of months with the year (MM/YYYY) for files received. I need to get it out of this table. There can be thousands of records in this table so the way I have done it, i...