Comments (15)
I'm personally not a fan of this. I think sql2o is the best lite ORM for java because of its simplicity, lack of code generation, and easy configuration. There are a few other orms that use annotations like these (see our performance tests for examples). I think this lib should stick roughly to its current api
from sql2o.
I'm not saying don't add it, just that I don't think it should live in the core sql2o that most people will use. Maybe we could make a separate maven artifact like "org.sql2o.extensions -> sql2o-annotations" that has this functionality
from sql2o.
Sql2o sql2o = new Sql2o(DB_URL, USER, PASS);
MyDAO dao = sql2o.for(MyDAO.class);
Person p = dao.getPersonById("1234");
@aldenquimby
this is just syntax sugar and better way to organize your selects instead of a set of string constants. I propose this as addiction to (not replacement).
from sql2o.
Ok I'm cool with adding this as an extension 👍. Maybe part of a 2.1 release. We've got a few things to wrap up for 1.5, then a bunch of refactoring for 2.0.
from sql2o.
@aldenquimby
it's really extreme easy to realize. take look @ this dimzon/sql2o@aaberg:master...master#diff-db1c02bce6d0da91c7b30ba1d14a74d0R3
and this dimzon/sql2o@aaberg:master...master#diff-83586bdab20f9864423e05dad297d05eR42
and this is initial unit-test
dimzon/sql2o@aaberg:master...master#diff-ced7fe1e4cfcfbacd902f77e280a18dbR137
from sql2o.
Interesting. After the 2.0 release we can make an extension artifact for it and you can put that code there. Also I think things may end up getting much more complicated than this. MyBatis supports annotations like this for all sql calls, and from looking at their code, it ends up being a pretty large undertaking.
What would you want to call the package? sql2o-annotations
or sql2o-generation
or something like that?
from sql2o.
@aldenquimby
the problem - I really like fluid interface pattern. this means i want to write
sql2o.toDAO(DAO.class)
instead of
DAOFactory.toDAO(sql2o, DAO.class)
unfortunally Java doesnt't have sexy 'extensions methods' features like C# so it's impossible to add toDAO
method without affectiong sql2o class....
from sql2o.
I support the idea of a sql2o-annotations extension. I would like to keep this out of the core library. We should not introduce any annotations or similar in the core-lib.
When that is said, I really like the concept, and I think it could become an awesome extension!
Other ideas for an 'annotations' extension, is annotations for generating entities (or pojos) through a constructor. Similar to jackson JsonCreator annotation. And maybe support for some JPA-annotations.
But all of this should not be a part of the core library.
from sql2o.
Other ideas for an 'annotations' extension, is annotations for generating entities (or pojos) through a constructor. Similar to jackson JsonCreator annotation. And maybe support for some JPA-annotations.
this can be done via external ResultSetHandlerFactory
from sql2o.
well, how to remove my annotations-related commits from pull request?
from sql2o.
get the commit-id of the commit with:
git log
You should pick the commit-id below the first commit you would like the remove. I guess the id you are looking for is e9216c1
to remove the commit
git reset e9216c169540b1de5317928bf86a583162acd1cf
This will remove the commit and unstage your changes. It will not remove any code you have written.
If you want to keep the code in another branch, you can create the branch, checkout the branch and commit to the branch.
git branch newBranchName
git checkout newBranchName
git add -A
git commit
To get back to your master-branch
git checkout master
from sql2o.
@aaberg
I'm sorry. All what I need is to reset to state before initial annotations commit (in other well-known CSV systems this is revert feature)
after I perform git reset e9216c169540b1de5317928bf86a583162acd1cf
i can't push any changes
dimzon@eee:~/git/sql2o$ git add core/src/main/java/org/sql2o/Query.java
dimzon@eee:~/git/sql2o$ git push
To https://github.com/dimzon/sql2o.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/dimzon/sql2o.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
from sql2o.
That is because git by default won't allow you to push anything that will remove commit from server. You have to force push.
git push --force
Sorry I forgot to mention this before.
from sql2o.
thanx!
2014-04-08 22:55 GMT+04:00 Lars Aaberg [email protected]:
That is because git by default won't allow you to push anything that will
remove commit from server. You have to force push.git push --force
Reply to this email directly or view it on GitHubhttps://github.com//issues/79#issuecomment-39887239
.
from sql2o.
The issue 10 years old. Closing.
from sql2o.
Related Issues (20)
- Warnings with Java 11, possible future denied operation HOT 2
- ORDER BY does not work with addParameter HOT 2
- Remove case sensitive converter
- Column mappings failed HOT 1
- Issue with ArrayParameters.updateQueryWithArrayParameters when query contains '?' character
- When in jar file I receive No suitable driver for error HOT 1
- Publish version 1.6.0 of oracle extensions
- sql2o can't rolback ? HOT 3
- can i change the Type of return value of executeAndFetch()
- State of the Project
- NPE when return query object is of type Map HOT 1
- How to correctly insert with array type (ex bigint[]) columns?
- Library uses now-private reflection mechanism HOT 2
- Can't add ON DELETE CASCADE to forein key when creating table, using PostgreSQL. HOT 1
- Updated MySQL 8.0.26 connector breaks historically working code HOT 2
- Next release HOT 2
- MethodSetter setProperty failing with generic IllegalArgumentException
- Failed test testAllTypes(org.sql2o.reflect.ReflectionFieldSetterFactoryTest) only in Maven HOT 2
- Collection of enums is not properly mapped to query params HOT 1
- SQL2o 1.6.0 Compatabile with JDK 17/ OpenJDK 17 ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sql2o.