Hibernate
by David Hernandez
Hi,
I´m wondering about persistence aplications using hibernet. I tried
Hibernate configuration with Netbeans but I have some problems. Do you have
some information or documentation about developing applications with
hibernet and netbeans, I´m interested in documentacion about swing
aplications
18 years, 3 months
More fun with merging : non-updatable fields
by Josh Moore
Using Hibernate with non-updatable fields can leave entities in a
confused state.
Take an Image with a field creationEvent, not updatable. If
Image.creationEvent is set on an instance and passed to session.merge(),
then:
(1) Properly, no UPDATE is issued.
(2) DefaultMergeEventListener.copyValues copies the invalid
creationEvent to the new instance
(3) The client who receives that instance thinks creationEvent has been
successfully updated.
What are the semantics here? Should the spec specify this? Max, you
mentioned via irc that this wasn't in the spec, but I assume
@Column( updatable = false )
would cause the same issue.
Currently I'm writing logic in my MergeEventListener to NOT copy these
values (difficult because of the EmbeddedComponentTypes I'm using). It
seems, however, that this should be belong directly to
DefaultMergeEventListener.
Opinions?
18 years, 3 months
RE: new SPI for EJB3/Seam (Gavin King)
by Josh Moore
Redirecting to list.jboss.org from sf.net
> For truly efficient clustering of extended persistence contexts in the
> context of Seam or EJB3, we need a way to propagate unflushed
> changesets. What we need is an SPI like this:
>
> Serializable changeset = session1.getChangeSet();
>
> session2.applyChangeSet(changeset);
>
> where session2 is an empty session, or perhaps even a session with some
> of the same entities as session1. The only state that needs to be sent
> in the changeset is new entities, unflushed updates to entities and
> deletions of entities.
>
> Steve, WDYT?
+1 even if my names not Steve. Seems like the same infrastructure would
also be usable in implementing a remote client session. (Discussed in
various places.)
~Josh.
18 years, 3 months
Snapshot conflict with merge
by Christian Bauer
I wrote (tested and verified with Gavin):
Finally, merging doesn’t allow the following scenario, where two
modifications conflict on one snapshot:
item.getId() // The database identity is "1234"
item.setDescription(...);
Session session= sessionFactory.openSession();
Transaction tx = session.beginTransaction();
Item item2 = (Item) session.get(Item.class, new Long(1234));
item2.setDescription(...); // Not allowed!
return session.merge(item); // Throws exception!
tx.commit();
session.close();
The detached object’s description is modified as well as the
persistent object’s. There is no way for Hibernate to determine who
will win in this situation and a StaleObjectStateException is thrown
when you try to merge() onto a dirty persistent instance.
Emmanuel comments:
No exception is raised in my tests. The merged state takes precedence
over the initially loaded and modified state (regardless the object
has been versioned or not) AFAIR, the spec does not talk about such
an exception either.
What is it?
18 years, 3 months