mybatipse icon indicating copy to clipboard operation
mybatipse copied to clipboard

Jpa mapping

Open kenjdavidson opened this issue 4 years ago • 6 comments

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

kenjdavidson avatar Jun 03 '20 19:06 kenjdavidson

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!

harawata avatar Jun 15 '20 16:06 harawata

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

kenjdavidson avatar Jul 07 '20 21:07 kenjdavidson

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.

harawata avatar Jul 08 '20 17:07 harawata

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.

kenjdavidson avatar Jul 08 '20 17:07 kenjdavidson

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 avatar Jul 08 '20 17:07 harawata

  • 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 avatar Aug 10 '21 13:08 kenjdavidson