Questions tagged [entity]

In computer science an entity is an object which has an identity and can be uniquely determined, holds storable information or can be processed. As the term has a very abstract and general meaning prefer to use this tag only in conjunction with other more specific tags.

In computer science an entity is an object which has an identity and can be uniquely determined, holds storable information or can be processed. The term does not apply to a specific technology but has a more abstract meaning.

An entity is one building block in an entity-relationship model (ERM) to describe how data are modeled in an information system.

Often used specific meanings for "Entity" on Stack Overflow

  • A class or instance of a class which is mapped to a relational database by Microsoft's Entity Framework
  • A data object in Apple's iOS Core Data Framework

Links

6026 questions
698
votes
31 answers

How to fix the Hibernate "object references an unsaved transient instance - save the transient instance before flushing" error

I receive following error when I save the object using Hibernate object references an unsaved transient instance - save the transient instance before flushing
Tushar Ahirrao
  • 10,773
  • 16
  • 61
  • 95
268
votes
19 answers

PersistentObjectException: detached entity passed to persist thrown by JPA and Hibernate

I have a JPA-persisted object model that contains a many-to-one relationship: an Account has many Transactions. A Transaction has one Account. Here's a snippet of the code: @Entity public class Transaction { @Id @GeneratedValue(strategy =…
Paul Sanwald
  • 9,766
  • 4
  • 38
  • 58
203
votes
16 answers

How to update only one field using Entity Framework?

Here's the table Users UserId UserName Password EmailAddress and the code.. public void ChangePassword(int userId, string password){ //code to update the password.. }
h3n
  • 4,786
  • 9
  • 40
  • 70
152
votes
17 answers

How to set a default entity property value with Hibernate

How do I set a default value in Hibernate field?
Dejell
  • 12,840
  • 37
  • 129
  • 217
124
votes
4 answers

What is the difference between persist() and merge() in JPA and Hibernate?

What is the difference between persist() and merge() in Hibernate? persist() can create a UPDATE & INSERT query, eg: SessionFactory sef = cfg.buildSessionFactory(); Session session = sef.openSession(); A a=new…
Jimit Tank
  • 1,379
  • 5
  • 17
  • 25
118
votes
9 answers

How to delete an object by id with entity framework

It seems to me that I have to retrieve an object before I delete it with entity framework like below var customer = context.Customers.First(c => c.Id == 1); context.DeleteObject(customer); context.Savechanges(); So I need to hit database twice.…
Jeff
  • 1,181
  • 2
  • 7
  • 3
113
votes
11 answers

Improving bulk insert performance in Entity framework

I want to insert 20000 records in a table by entity framework and it takes about 2 min. Is there any way other than using SP to improve its performance. This is my code: foreach (Employees item in sequence) { t = new Employees (); t.Text =…
Vahid Ghadiri
  • 3,648
  • 5
  • 32
  • 43
99
votes
1 answer

cascade={"remove"} VS orphanRemoval=true VS ondelete="CASCADE

I tried to gather some information about the following way to delete automatically child entity when a parent entity is deleted. Seems that the most common way is to use one those three annotation: cascade={"remove"} OR orphanRemoval=true OR…
Alexis_D
  • 1,758
  • 2
  • 14
  • 32
88
votes
15 answers

EF 4.1 exception "The provider did not return a ProviderManifestToken string"

I am trying to replicate an example found on MSDN. I am using ASP.NET and EF 4.1 (CTP?). I've used NuGet to install the EntityFramework package. I am getting this error: The provider did not return a ProviderManifestToken string ... and the database…
bugnuker
  • 3,778
  • 7
  • 22
  • 30
83
votes
4 answers

what is difference between a Model and an Entity

I am confused to understand what is the meaning of this words: Entity, Model, DataModel, ViewModel Can any body help me to understanding them please? Thank you all.
agent47
  • 6,467
  • 15
  • 50
  • 79
77
votes
4 answers

Entity Framework - Is there a way to automatically eager-load child entities without Include()?

Is there a way to decorate your POCO classes to automatically eager-load child entities without having to use Include() every time you load them? Say I have a Class Car, with Complex-typed Properties for Wheels, Doors, Engine, Bumper, Windows,…
72
votes
7 answers

How can I disable migration in Entity Framework 6.0

I'm trying to ignore the "Automatic" migration using Entity Framework 6.0 rc1. My problem is that I don't want this feature right now and every time that my application runs I can see all entity logs trying to create all tables. Anticipate thanks.
69
votes
5 answers

Symfony2 collection of Entities - how to add/remove association with existing entities?

1. Quick overview 1.1 Goal What I'm trying to achieve is a create/edit user tool. Editable fields are: username (type: text) plainPassword (type: password) email (type: email) groups (type: collection) avoRoles (type: collection) Note: the last…
ioleo
  • 4,369
  • 5
  • 42
  • 59
67
votes
6 answers

Should I write equals() and hashCode() methods in JPA entities?

I want to check if entity is in a Collection member (@OneToMany or @ManyToMany) of another entity: if (entity2.getEntities1().contains(entity1)) { }
j2j
  • 761
  • 2
  • 8
  • 7
62
votes
12 answers

How can I get my database to seed using Entity Framework CodeFirst?

The database is created successfully (as are the tables) but is not seeded. I have spent several hours and read tons of articles but have not been able to get it. Any suggestions? On a side note, is it possible to call the initializer without having…
Alec
  • 1,507
  • 3
  • 16
  • 32
1
2 3
99 100