[deepamehta-devel] creating topics from listener method

Robert Schuster robert.schuster.rs01 at gmail.com
Mon Dec 4 18:27:47 CET 2017


Hi guys,
I am trying to resolve a straightforward thing:

Upon log-in I want to check whether a bunch of user related topics exist
and if they don't create them.

So I implement the PostLoginUserListener's postLoginUser method and do
my checks.

Then there is the method that creates new topics which looks like this:

        ChildTopicsModel childs = mf.newChildTopicsModel();

        // put data inside
        // <removed for the example>
       
        Topic t = dm4.createTopic(mf.newTopicModel(NS.user.self(), childs));
       
        long wsId =
wsService.getAssignedWorkspace(acService.getUsernameTopic(userName).getId()).getId();
       
        assignToWorkspace(wsId, t);

When this code runs it will actually cause an exception because there is
no transaction context.
If it were a normal rest method I'd add @Transactional and all would be
fine. However I don't have this option, so I thought I'd do a TX myself
and surrounded the above code with:

        DeepaMehtaTransaction tx = dm4.beginTx();

        // code from above

        tx.finish();
        tx.success();

Unfortunately that does not do anything. I don't see errors in the log
but the actual topic is not created either.

*puzzled*

Any idea what I am doing wrong?

All the best,
Robert

-- 
Robert Schuster
freiberuflicher Softwareingenieur

RS01 - IT-Systemanalyse und -entwicklung Robert Schuster
Kalkbergeweg 75 • 12589 Berlin
+49 157 798 00 310
robert.schuster.rs01 at gmail.com



More information about the devel mailing list