Finally figure out my atlassian account so i could go with the hibernate
issues ;)
> What is the equivalent way to do this in new metadata api:
>
> ```
> new Configuration().setProperty("hibernate.dialect",
> "org.hibernate.dialect.H2Dialect")
> .setProperty("hibernate.connection.url",
> "jdbc:h2:./sakila")
> .setProperty("hibernate.connection.username",
> "sa")
> .buildSessionFactory();
> ```
>
> Just setup dialect, give connection info and get a
> sessionfactory/entitymanager ?
>
> I found apis to start from a file containing those settings; but I
> really just want a programmatic api
> to use in batch script etc. without a need for external files.
Agreed we should explore making the "frameworkless bootstrap" simpler;
booting the ORM today requires some expertise, resulting in people to
rely on other frameworks to do the job.
I think documentation could go a long way - I couldn't find anywhere
in the docs the minimal step for configuring hibernate programmatically.
All seem to assume you have external files for it.
However, the possible configuration options we have today are
significant; there's good reasons to have them so while an helper
would be welcome, I don't expect we'll want to change or simplify the
existing boot code, as it's working and doing a great job. This would
rather provide a simple, limited alternative.
It will be necessary to clarify that the "simple" alternative is also
very limiting: for example I could see myself volunteering to create
such a little toy, but don't expect it to work in modular
environments, containers, pick up transaction managers, integrate with
DI frameworks, allow for Datasource injection, etc. etc.. Ok?
well, maybe the existing Configuration api is that "toy" already ?
A consequence of such limitations would be that runtime performance
and efficiency would also be limited; let's be upfront about the
intent in the API documentation.
I can try toy with a POC but can't promise a quick turnaround on this
one; not least I'd need Steve's blessing and review:
-
https://hibernate.atlassian.net/browse/HHH-13862
Please comment on the JIRA or send a PR if you have a more concrete
idea or a draft.
will do - but I don't have much to add for now....looking forward to see
what Steve thinks on this.
> Here again, the ask is so we can educate and point people to use
> statelessSession rather than dropping Hibernate fully and from that
> api if needed go do `.doWork()` rather than refer to deprecated
> `.connection()`
Makes sense, I believe we should be able to do this quickly:
-
https://hibernate.atlassian.net/browse/HHH-13861
Andrea volunteered to have a look; assigned to him assuming it's
straight forward; if it gets tricky we'll have to wait for Steve's
opinion.
that one is now fixed and that’s awesome. one less deprecation I'm
forced to use :)