Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider a "hibernate like" criteria maker: #25

Open
gencube opened this issue Jun 8, 2015 · 1 comment
Open

Consider a "hibernate like" criteria maker: #25

gencube opened this issue Jun 8, 2015 · 1 comment

Comments

@gencube
Copy link

gencube commented Jun 8, 2015

Hi,

Since there is no plan to turn RxJDBC into a ORM, but perhaps ONLY this portion of the
Library will be useful for the user of your library to avoid the JDBC-(Postgress/MySQL/Oracle/MsSQL...)SQL conversion error.

Consider a hack into this Hibernate Code and how to merge into your library:
How to get SQL from Hibernate Criteria API (not for logging)
http://stackoverflow.com/questions/554481/how-to-get-sql-from-hibernate-criteria-api-not-for-logging

CriteriaImpl criteriaImpl = (CriteriaImpl)criteria;
SessionImplementor session = criteriaImpl.getSession();
SessionFactoryImplementor factory = session.getFactory();
CriteriaQueryTranslator translator=new CriteriaQueryTranslator(factory,criteriaImpl,criteriaImpl.getEntityOrClassName(),CriteriaQueryTranslator.ROOT_SQL_ALIAS);
String[] implementors = factory.getImplementors( criteriaImpl.getEntityOrClassName() );

CriteriaJoinWalker walker = new CriteriaJoinWalker((OuterJoinLoadable)factory.getEntityPersister(implementors[0]), 
                        translator,
                        factory, 
                        criteriaImpl, 
                        criteriaImpl.getEntityOrClassName(), 
                        session.getLoadQueryInfluencers()   );

String sql=walker.getSQLString();
@davidmoten
Copy link
Owner

yep would be nice, #24 would be a prerequesite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants