Home » Search

About Entity

161-170 of 200Refresh
Forum
10

Embedding Managed Entities in Embedded Objects = bad idea

Discovered that you can't embed entities in embeddable objects if the entity is managed. Haven't tried embedding un-managed entities in embeddable objects, though I imagine that's not a great idea. The the error message isn't all that obvious (attempting to persist object which already has an id
Forum
10

Entity factory

Hi, is it possible to create Entities with a custom factory? I want to create Entity instances via dependency injection like: @Entiy public class User { private final UserService userService ... in a ThreadLocal and access it inside the new Entity to inject the dependencies.
Forum
10

Entity factory - best practices

initiate a db connection by creating entity manager factory from db on disk, get the entity manager, modify ... one every time. Out of curiosity, is my current method thread-safe? Can multiple entity managers exist
Forum
10

Entity has be persistended,but query not fetched?

I create a new entity T newT and persistend it,then I create a query "select t from T t" to fetch all T entities.But  then the newT is not contain in the query result. Why? code order: query ... ();         em.close();         emf.close();     }         @Entity     static final class User
Forum
10

Fetch a whole entity graph eager

Hello, I have two question at you. Are you provided JPA 2.1 annotation @NamedEntityGraph in next version ObjectDB 3.0? And do you know an easy possibility to get an entirely eager entity graph with all depended entities which we can use as a detached full accessible entity graph outside
Forum
10

How to check if an entity exists in a Database without loading it?

Hi, I am trying to speed up some code - where i check if an entity exists in order to make a decision. In Java - It looks like this (pk - is the primary key of the entity): MyClass find = em.find ... without loading the entity? Thanks   You can use a query: SELECT e.pk FROM MyClass e WHERE e.pk = :pk or SELECT COUNT(e) FROM MyClass e WHERE e.pk = :pk   EKK
Forum
10

Merge of entity classes with "mapped by" very slow

Hi, I have found a strange behavior when merging entities with "mapped by" set on @OneToMany ... - one with mapped by, second with adding entities list without "mapped by". The difference is huge event ... entity objects that are already managed should be very fast. Build 2.4.2_02 fixes it. If the problem
Forum
10

Merge with Parent/Child entities not possible

javax.persistence.Entity; import javax.persistence.EntityManager; import javax.persistence ... ; import org.junit.Before; import org.junit.Test; public class ObjectDbMergeTest { @Entity ... = id;   } } @Entity public static class ChildEntity {   @Id   @GeneratedValue   private
Forum
10

Populating entity id before transaction commit

transaction is committed so all returned entities are not populated with ID in this context. How can I force ODB to populate entity ID before transaction is committed? Or maybe there is another way to finding ID of entity before commit? You can use a SEQUENCE (or TABLE) value generation strategy
Forum
10

Removing an entity throws exception

to remove customer entity, when it's read by a query (it's attached), it throws this exception ... more   After this exception is the entity detached (why?). When I merge it, I can remove it without problems... The Customer class code: @Entity public class Customer implements Serializable { private