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

Jpa mapping #101

Closed
wants to merge 37 commits into from
Closed

Jpa mapping #101

wants to merge 37 commits into from

Conversation

kenjdavidson
Copy link

Issue #94

I get that it's like a year later, but I've been using this and it has sped up a lot of my development/conversion to MyBatis. I just setup the project again and fixed a couple bugs that make it more accurate. There are still a number of things missing:

  • Association details, the XML will have an entry, but require some data to be populated.
  • Collection details, same thing as association

It's really just a rough start for the functionality, but at least it's a start. I can continue to work on it as I start modifying the original code to be better formatted and take advantage of more object relationships (rather than how it's working now).

All resultMap <Results> are now populated using the builder and any JPA
annotations that might be available.
Add <sql> blocks for insert, update and select columns based on the
selected result set.
Updated SQL was not completed, it was a duplicate of insert.
Moved the result element creation to a set of interface/classes that can
be extended upon more easily than the previously used enumeration.
Started initial work on collection and association elements, although
these need much more work.
All resultMap <Results> are now populated using the builder and any JPA
annotations that might be available.
Add <sql> blocks for insert, update and select columns based on the
selected result set.
Updated SQL was not completed, it was a duplicate of insert.
Moved the result element creation to a set of interface/classes that can
be extended upon more easily than the previously used enumeration.
Started initial work on collection and association elements, although
these need much more work.
@harawata
Copy link
Member

Thank you for the PR, @kenjdavidson ,
I'm sorry about the delay.
I don't have much spare time lately and am also working on something super complicated, so please give me some more time!

@kenjdavidson
Copy link
Author

Anything you'd like me to look at with regards to this?

@harawata
Copy link
Member

harawata commented Jul 8, 2020

Hello @kenjdavidson ,

Sorry about the delay!
I actually want to see if it's possible to retrieve information about JPA annotations when this action is triggered rather than parsing and storing it in BeanPropertyCache for every bean.
How does that sound?

As it's been a while since the last release, I plan to release 1.2.4 without this soon.

@kenjdavidson
Copy link
Author

Right on, I will try to take a look at it next time I have a couple hours free to do so. I remember that I did it a particular way because there was missing information about the Class being on which the task was being performed, it was a while ago, so I can't exactly remember. In order to get what I wanted to work, I would have had to re-write a larger portion of the handlers, which I wasn't ready to do at the time.

Not sure when, but I'll follow up with some analysis of how to get that working.

@harawata
Copy link
Member

harawata commented Jul 8, 2020

I haven't reviewed it thoroughly, so it's possible that I am missing something.
As you have done a lot already, I was going to try it myself, but it would be greatly appreciated if you could take a look!

harawata and others added 12 commits February 24, 2021 00:18
Reports error when 1) the specified method is not found or 2) the return type of the method is not assignable to CharSequence
# The first commit's message is:
Initial addition of JPA Result auto completion
# This is the 2nd commit message:
Updated plugin version
# This is the 3rd commit message:
Refactored ResultBuilder to ResultMapContentBuilder

All resultMap <Results> are now populated using the builder and any JPA
annotations that might be available.
# This is the 4th commit message:
Added Mapper Source options for SQL blocks

Add <sql> blocks for insert, update and select columns based on the
selected result set.
# This is the 5th commit message:
Todo comments
# This is the 6th commit message:
Resolved issue with Update

Updated SQL was not completed, it was a duplicate of insert.
# This is the 7th commit message:
Updated formatting and output of <sql> blocks
# This is the 8th commit message:
Resolved issue with parameter name and value
# This is the 9th commit message:
update formatting of lines - removal of Id Results
# This is the 10th commit message:
Refactored Result map element creation classes

Moved the result element creation to a set of interface/classes that can
be extended upon more easily than the previously used enumeration.
Started initial work on collection and association elements, although
these need much more work.
# This is the 11st commit message:
Removed plugin extension for invalid servers
# This is the 12nd commit message:
Initial addition of JPA Result auto completion
# This is the 13rd commit message:
Updated plugin version
# This is the 14th commit message:
Refactored ResultBuilder to ResultMapContentBuilder

All resultMap <Results> are now populated using the builder and any JPA
annotations that might be available.
# This is the 15th commit message:
Added Mapper Source options for SQL blocks

Add <sql> blocks for insert, update and select columns based on the
selected result set.
into jpa-mapping

Conflicts:
	mybatipse/src/net/harawata/mybatipse/mybatis/ResultMapContentBuilder.java
	mybatipse/src/net/harawata/mybatipse/source/handler/ResultMapInsertSqlHandler.java
	mybatipse/src/net/harawata/mybatipse/source/handler/ResultMapSelectSqlHandler.java
	mybatipse/src/net/harawata/mybatipse/source/handler/ResultMapSqlSourceHandler.java
	mybatipse/src/net/harawata/mybatipse/source/handler/ResultMapUpdateSqlHandler.java
@kenjdavidson
Copy link
Author

  • Rebased with latest changes
  • Updated Association and Collection(s) to include basic javaType and ofType

With regards to the BeanPropertyCache I'm not entirely sure what the best course of action is. The BeanPropertyCache is refreshed if the Bean is changed:

  • MybaptipseResourceChangeListener is responsible for this

If the goal was to ensure that all the annotations are up to date, then this is already done.

The original BeanPropertyInfo is still required, as if there is no @Entity on found, then it reverts back to the original functionality of just using the field name (from the BeanPropertyInfo). The only way to do this would be to:

  • Store the Class<?> in the propertyInfo, which could be problematic, I have to look at the IType being used
  • Store the qualifiedName and then reflect that during the generateResult and either handle JPA or the original BeanPropertyInfo fields anyhow

Thoughts?

@kenjdavidson kenjdavidson closed this by deleting the head repository Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants