mirage-sql / mirage Goto Github PK
View Code? Open in Web Editor NEWMirage-SQL - the SQL Centric Database Access Library for Java
License: Apache License 2.0
Mirage-SQL - the SQL Centric Database Access Library for Java
License: Apache License 2.0
Extend the DB Dialect support with DB Version information too.
This is needed because:
many of the libraries mirage depends on (from pom.xml) seem outdated.
please update them.
Refactor Tools to it's own module.
SqlExecutor outputs a SQL and parameters for SQL at INFO level, so useful for debug.
But, parameters sometimes contains some sensitive information. (ex. address)
So, I think that the logging in SqlExecutor should make lower logging level. (ex. DEBUG)
Regards.
Add Java 8 JSR 310 compatibility.
Please make MirageSQL Java 8 compatible.
First thing that fails when building it is even the JavaDoc task with Java 8.
Thank you.
Add the convention that "id" for fields are treated as primary keys even if they are not annotated, and there's no other annotated field.
The generation type should be that of the default for the selected Dialect.
We should update some parts of project information in pom.xml
.
Also we need assembly plugin no longer.
Generate DDLs from Entities - so the opposite of EntityGenTask.
Also:
Describe EntityGen
and EntityGenTask
.
Please publish to Maven the sources too: the latest version seems to have only the binary, and javadoc jar, but not the sources jar (required by IDEs)
Thank you.
Create a new Icon and Logo, since there are no "sources" for the old one.
Any suggestion of how could/should it look is welcome.
Update the mirage maven site to user bootstrap.
Here's how it can be done: http://blog.akquinet.de/2012/04/12/maven-sites-reloaded/
Hi,
IMO the main page (welcome page) in the "What is Mirage" section besides "2WaySQL" and "SQL less Update" should be updated with the most important feature Mirage SQL has: Dynamic SQL support (with externalized queries to SQLs to files with named parameters ).
IMO this is the most important feature Mirage has, and in all projects I've seen mirage, the reason why it was used was to:
All in one, the above allow an extremely maintainable code compared to the traditional approach, and also a very fast development process, since the DB people can work in parallel directly on those SQL files.
Please allow other means to configure the connection too, since this is just too restrictive.
At the moment SessionFactory
seems to have only one method: getSession()
, so without any parameters, thus relying only on thejdbc.properties
for connections.
E.g. when used with H2 in a web application, H2 puts the connection in the ServletContext: getServletContext().getAttribute("connection");
For webapplications is also common to use JNDI to get the connection (from the pool) since this is configured in the application server itself (e.g. Tomcat).
regards.
The idea of Mirage and the problem it solves is simply fantastic.
It's just a pity that most users don't get it, and your project is not very well known (maybe some better docs could help ?).
Another option would be to have it not just in Java, but in other languages too, at least the part with prepared statement variable handling.
The JUnit dependency is "compile" configuration.
So, build artifacts(e.g. war, jar etc) include "junit.jar" in them.
Is this correct setting?
Could you tell me when the Mirage-SQL 2.0.x is released?
Generate Website the website using https://github.com/staticmesh
The generated Insert and Delete field order is not predictable, thus causing unit test errors.
Please add Derby dialect support.
User SLF4J instead of java.util.logging to allow the users to user whatever logger they need in the project, and not be forced to use more than one.
Please add DB2 Dialect support.
Support Maps, not just Entities. At the moment this does not seem to really work because:
map
(so no more than one Map can be used in a project)Please deploy the Mirage Maven Artifacts to MavenCentral too.
Nowadays people use http://search.maven.org to search for packages and versions, and Mirage is not there :(.
The SEO is quite bad as even the website is hard to find: see #8
regards.
Please translate and document at least the SQL parser part of Mirage.
It looks like a very interesting functionality that might have use in many projects.
Thank you very much.
Please add JavaDocs Maven artifacts to the build process and also to the deployed Amateras repository (at the moment they seem to be missing).
regards.
Generate Groovy Entities
Add H2 Database Dialect.
Please add MS SQL Server dialect support.
All docs was already moved to GitHub Wiki. So we should remove docs from source tree and remove Maven site and settings about site from pom.xml
.
Split the project in several maven modules (and jars).
It would allow an easier reuse of the different parts of Mirage SQL, and also easier to extend.
E.g. there's stuff not needed at runtime, or not by everybody, but still gets deployed since it's there in the same JAR:
and other parts that would be reusable outside of Mirage like:
The version 2.1.0 is written on the README, but it has not been published.
If the release schedule has been planed, could you please let me know it?
Please add support for the "for" command in the SQL parser.
E.g. Something like below might be a possibility:
select * from book
/* if $tags !=null AND !$tags.isEmpty() */
where book.published > 2011
/* FOR $tag in $tags */
and book.tag = /*$tag*/'mirage'
/*END*/
/*END*/
Of course, one option might be for the above example to use IN
with arrays, but because it's bound to only one parameter this is open to SQL Injection, so in this case the Prepared Statement doesn't bring too much advantage and security.
(besides there are many more cases where it's simply not possible to reformulate the statement to make use of IN
with arrays).
Thank you very much.
It would be quite useful for us if the API would allow to get list of all the parsed variables and their default values from a SQL String
Since we have many and big SQLs it happend quite allot that users make errors, so we would like to write a checking task, but for this we need the list of variables and values an SQL contains.
tnx
I would like to use entity with immutability, such as @PersistenceConstructor in spring data mongodb.
Do you have any roadmap for immutable entity?
I try to implement in #73.
Make project Java 9 compatible (all it's modules) too:
Add integration tests with as many as possible DBs (not just embedded hsqldb).
One approach might be to use: https://github.com/flapdoodle-oss/de.flapdoodle.embed.process .
Another one might be to use CI provided DBs.
Please give an example how to use arrays as parameters in dynamic sqls.
Looking at "ParenBindVariableNode.java" seems to be possible to use arrays and lists as parameters.
Thanks in advance.
HikariCPSessionImpl fails to "new HikariCPSessionImpl (properties)".
PropertyElf.setTargetFromProperties(config, properties)
// set Hikari optional properties. All start with "dataSource.XXX"
PropertyElf.setTargetFromProperties(config, properties);
↓↓↓
Properties hikariProperties = new Properties(properties);
hikariProperties.remove("jdbc.driver");
hikariProperties.remove("jdbc.url");
hikariProperties.remove("jdbc.user");
hikariProperties.remove("jdbc.password");
hikariProperties.remove("sql.cache");
// set Hikari optional properties. All start with "dataSource.XXX"
PropertyElf.setTargetFromProperties(config, hikariProperties);
This change workes for me.
final Properties properties = new Properties();
p.setProperty("jdbc.driver", "org.h2.Driver");
p.setProperty("jdbc.user", "sa");
p.setProperty("jdbc.password", "pas");
p.setProperty("jdbc.url", "jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1");
p.setProperty("sql.cache", "false");
final HikariCPSessionImpl hs = new HikariCPSessionImpl(properties);
18:42:03.823 [main] DEBUG com.zaxxer.hikari.HikariConfig - Driver class org.h2.Driver found in Thread context class loader jdk.internal.loader.ClassLoaders$AppClassLoader@383534aa
18:42:03.824 [main] ERROR com.zaxxer.hikari.util.PropertyElf - Property jdbc.password does not exist on target class com.zaxxer.hikari.HikariConfig
18:42:03.847 [main] ERROR j.t.MirageSessionTransactionManagerTest - Property jdbc.password does not exist on target class com.zaxxer.hikari.HikariConfig
java.lang.RuntimeException: Property jdbc.password does not exist on target class com.zaxxer.hikari.HikariConfig
at com.zaxxer.hikari.util.PropertyElf.setProperty(PropertyElf.java:135)
at com.zaxxer.hikari.util.PropertyElf.lambda$setTargetFromProperties$0(PropertyElf.java:59)
at java.base/java.util.concurrent.ConcurrentHashMap.forEach(ConcurrentHashMap.java:1603)
at java.base/java.util.Properties.forEach(Properties.java:1443)
at com.zaxxer.hikari.util.PropertyElf.setTargetFromProperties(PropertyElf.java:54)
at com.miragesql.miragesql.session.HikariCPSessionImpl.<init>(HikariCPSessionImpl.java:97)
at javamavensample.dao.miragesession.HikariCPSessionManager.init(HikariCPSessionManager.java:19)
at javamavensample.transaction.MirageSessionTransactionManager.init(MirageSessionTransactionManager.java:29)
at javamavensample.transaction.MirageSessionTransactionManagerTest.transactionInitTest(MirageSessionTransactionManagerTest.java:18)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:210)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:206)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:131)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:65)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:220)
at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:188)
at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:142)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:117)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
I would propose to rename the project to be easier to find.
Searching after "mirage" on Google or other search engines, and even on Github does not return this project, nor the sourceforge one :(.
If I search after "mirage + SQL" than I can find it, but I have to know this.
IMO best bet would be to rename this project to mirageSQL
or mirage-sql
or at least to something that's not such a common name :).
Please add SQLite dialect support.
The javaTypeToSqlType method in AbstractValueTpe.java is not accept java's boolean data type.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.