i think i'm preventing nested queries as possible, i'm not sure. understand calls here can executed in single select query, did simplify example. // example in typescript // find user user.find({where:{username:'user'}}) // if found user .then(function(user) { return user.find({where:{username:'other_user'}}) // if found other_user .then(function(other_user) { // stuff return whatever_i_need } // if went wrong, go straight parent catch .catch(function(err) { // stuff throw new error() } } // if previous .then() returned success .then(function(data) { return user.find({where:{username:'yet_another_user'}}) // if found yet_another_user .then(function(yet_another_user) { // stuff return whatever_i_need_again ...
i creating web application spring-mvc, spring-security, spring-core, , hibernate. but non-error hibernate session factory. it throwing hibernateexception, see on log in debug level, , application continues execution no problem. but curious understand reason of exception raised. the log shows following lines. 2016-08-29 13:34:55,310 debug [sg.com.diamond.express.base.dao.impl.hibernatedaoimpl].[doexecute]([328]) [http-nio-8888-exec-4] - not retrieve pre-bound hibernate session org.hibernate.hibernateexception: not obtain transaction-synchronized session current thread @ org.springframework.orm.hibernate4.springsessioncontext.currentsession(springsessioncontext.java:134) @ org.hibernate.internal.sessionfactoryimpl.getcurrentsession(sessionfactoryimpl.java:1014) @ org.springframework.orm.hibernate4.hibernatetemplate.doexecute(hibernatetemplate.java:325) @ org.springframework.orm.hibernate4.hibernatetemplate.executewithnativesession(hibernatetemplate.java:308)...
in controller, after reprioritizing "child", lists children in new order: @child.parent.children.sort_by{|g| g.priority } this, surprisingly, doesn't work: @child.parent.children.order(priority: :asc) why doesn't .order work? instead of sorting correctly, it's sorting previous order before operation run, assume it's using cached results (the query run before in operation). how 1 bust cache, if indeed problem? i've tried @child.reload after reprioritizing no avail. if have ordering on children association might try use reorder apply new ordering: @child.parent.children.reorder(priority: :asc)
Comments
Post a Comment