Git Product home page Git Product logo

Comments (15)

aldenquimby avatar aldenquimby commented on July 26, 2024

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.

aldenquimby avatar aldenquimby commented on July 26, 2024

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.

dimzon avatar dimzon commented on July 26, 2024
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.

aldenquimby avatar aldenquimby commented on July 26, 2024

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.

dimzon avatar dimzon commented on July 26, 2024

@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.

aldenquimby avatar aldenquimby commented on July 26, 2024

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.

dimzon avatar dimzon commented on July 26, 2024

@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.

aaberg avatar aaberg commented on July 26, 2024

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.

dimzon avatar dimzon commented on July 26, 2024

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.

dimzon avatar dimzon commented on July 26, 2024

well, how to remove my annotations-related commits from pull request?

from sql2o.

aaberg avatar aaberg commented on July 26, 2024

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.

dimzon avatar dimzon commented on July 26, 2024

@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.

aaberg avatar aaberg commented on July 26, 2024

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.

dimzon avatar dimzon commented on July 26, 2024

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.

aaberg avatar aaberg commented on July 26, 2024

The issue 10 years old. Closing.

from sql2o.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.