Alternative suggestions to creating a TransactionEventHandler for UID generation?

53 views
Skip to first unread message

Stacy Tyler Young

unread,
Aug 17, 2012, 6:06:03 PM8/17/12
to Neo4j
I'm using a TransactionEventHandler to generate a UID for entities (to avoid using graph id) but doing so in the transaction has its drawbacks. For one, if you're using @Transactional on a method the UID property value is not accessible within said method. I'd rather not start dropping txn boilerplate code into my classes ...anyone have an alternative approach?

Michael Hunger

unread,
Aug 18, 2012, 3:16:17 AM8/18/12
to ne...@googlegroups.com
Stacy,

can you raise a JIRA issue for that ?
In general I think it would be sensible to have a callback mechanism at "save()" instead of relying on the lower-level tx handlers of Neo4j.

Michael

Am 18.08.2012 um 00:06 schrieb Stacy Tyler Young:

> I'm using a TransactionEventHandler to generate a UID for entities (to avoid using graph id) but doing so in the transaction has its drawbacks. For one, if you're using @Transactional on a method the UID property value is not accessible within said method. I'd rather not start dropping txn boilerplate code into my classes ...anyone have an alternative approach?
>
> --
>
>

Stacy Tyler Young

unread,
Aug 18, 2012, 8:42:19 PM8/18/12
to ne...@googlegroups.com
What would you say to an even more direct approach to satisfying this use case. Perhaps an annotation to indicate a) unique key must be generated and b) implementation of generator class for said key?

Stacy


--



Stacy Tyler Young

unread,
Aug 18, 2012, 8:43:01 PM8/18/12
to ne...@googlegroups.com
Maybe even just an additional option on @Indexed?

Michael Hunger

unread,
Aug 19, 2012, 4:45:03 AM8/19/12
to ne...@googlegroups.com
Yep, that is another thing I'd like to add.

Michael

Please raise a JIRA issue for those 2 things.

--
 
 

Reply all
Reply to author
Forward
0 new messages