Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am currently working on a portal application for a restaurant. The backend database used is Mysql and I am using Spring JDBC support for writing data access logic.

Some of my DAOs are cluttered with multiple queries and are getting upto thousand lines of code in size. I think I can reduce the size and complexity by moving some of my logic into a SQL-PSM procedure (Since data binding and glue code in Java is an abomination from hell).

However I do not have DDL rights on the Db and hence cannot create the procedure.

I was wondering if there is a way to create a discard-ableemporary procedure that you can execute directly like a DML statement without having to create it first.

i.e. I want a procedure minus the create keyword, that would do my work, return the result and disappear.

Googled it a lot but couldn't find anything. :'( Just wondering if you folks know an elegant solution.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
257 views
Welcome To Ask or Share your Answers For Others

1 Answer

I guess you are looking for anonymous code blocks / anonymous procedures. Unfortunately it isn't supported in MySQL (it is supported in "big" RDBMSs such as Oracle or Sybase)

I would consider using some ORM framework, but I am not a Java developer, so I can't recommend any of them.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...