- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 3.7k
 
DRAFT: Merge tools into orm #11123
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
base: main
Are you sure you want to change the base?
DRAFT: Merge tools into orm #11123
Conversation
| 
           Thanks for your pull request! This pull request appears to follow the contribution rules. › This message was automatically generated.  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
9d4e4ec    to
    094c21a      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a few comments below to track things we discussed and that we shouldn't forget.
Also created a Jira issue: https://hibernate.atlassian.net/browse/HHH-19879
| import org.hibernate.tool.gradle.task.GenerateJavaTask; | ||
| import org.hibernate.tool.gradle.task.RunSqlTask; | ||
| 
               | 
          ||
| public class Plugin implements org.gradle.api.Plugin<Project> { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be the same plugin as enhancement, so that we can use a syntax like this one:
hibernate {
    enhancement { ... }
    reveng { ... }
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honest question: would this make sense to use in an application/framework as a library, and if so do we want to keep this module under tooling/?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Todo: migrate (all?) other tests from Tools. We can target h2 only for a start.
Main challenge would be conveting hbm.xml to orm.xml (mapping.xml?) or annotations.
| @Mojo( | ||
| name = "hbm2orm", | ||
| defaultPhase = GENERATE_RESOURCES, | ||
| requiresDependencyResolution = ResolutionScope.RUNTIME) | ||
| public class TransformHbmMojo extends AbstractMojo { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great and I know people have been asking for it.
We need it documented, though :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is something wrong here. Seem you duplicated the package? The SchemaExport class already exists in this module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, the classes you duplicated here should instead be moved from hibernate-ant to this module.
8239046    to
    30152da      
    Compare
  
    0678f91    to
    d3636e2      
    Compare
  
    | import org.hibernate.tool.reveng.internal.export.java.Cfg2JavaTool; | ||
| import org.jboss.logging.Logger; | ||
| 
               | 
          ||
| import java.io.File; | 
Check notice
Code scanning / CodeQL
Constant interface anti-pattern Note
ExporterConstants
| 
               | 
          ||
| protected MetadataDescriptor getMetadataDescriptor() { | ||
| return (MetadataDescriptor)getProperties().get(METADATA_DESCRIPTOR); | ||
| } | 
Check notice
Code scanning / CodeQL
Exposing internal representation Note
after this call to getProperties
getProperties exposes the internal representation stored in field properties. The value may be modified
after this call to getProperties
getProperties exposes the internal representation stored in field properties. The value may be modified
after this call to getProperties
getProperties exposes the internal representation stored in field properties. The value may be modified
after this call to getProperties
getProperties exposes the internal representation stored in field properties. The value may be modified
after this call to getProperties
getProperties exposes the internal representation stored in field properties. The value may be modified
after this call to getProperties
getProperties exposes the internal representation stored in field properties. The value may be modified
after this call to getProperties
getProperties exposes the internal representation stored in field properties. The value may be modified
after this call to getProperties
getProperties exposes the internal representation stored in field properties. The value may be modified
after this call to getProperties
getProperties exposes the internal representation stored in field properties. The value may be modified
after this call to getProperties
getProperties exposes the internal representation stored in field properties. The value may be modified
after this call to getProperties
getProperties exposes the internal representation stored in field properties. The value may be modified
after this call to getProperties
getProperties exposes the internal representation stored in field properties. The value may be modified
after this call to getProperties
| iterator = getProperties().entrySet().iterator(); | ||
| while ( iterator.hasNext() ) { | ||
| Entry<Object, Object> element = iterator.next(); | ||
| Object value = transformValue(element.getValue()); | 
Check notice
Code scanning / CodeQL
Unread local variable Note
        
          
                .../hibernate-reveng/src/main/java/org/hibernate/tool/reveng/internal/export/doc/DocFolder.java
              
                Fixed
          
            Show fixed
            Hide fixed
        
              
          
                .../hibernate-reveng/src/main/java/org/hibernate/tool/reveng/internal/export/doc/DocHelper.java
              
                Fixed
          
            Show fixed
            Hide fixed
        
              
          
                ...ate-reveng/src/main/java/org/hibernate/tool/reveng/internal/export/java/EntityPOJOClass.java
              
                Fixed
          
            Show fixed
            Hide fixed
        
              
          
                ...e-reveng/src/main/java/org/hibernate/tool/reveng/internal/export/java/ImportContextImpl.java
              
                Fixed
          
            Show fixed
            Hide fixed
        
              
          
                ...reveng/src/main/java/org/hibernate/tool/reveng/internal/export/lint/EntityModelDetector.java
              
                Fixed
          
            Show fixed
            Hide fixed
        
              
          
                ...ng/hibernate-reveng/src/main/java/org/hibernate/tool/reveng/internal/util/NameConverter.java
              
                Fixed
          
            Show fixed
            Hide fixed
        
              
          
                tooling/hibernate-reveng/src/main/java/org/hibernate/tool/reveng/internal/util/StringUtil.java
              
                Fixed
          
            Show fixed
            Hide fixed
        
      d906480    to
    c35239f      
    Compare
  
            
          
                ...ate-reveng/src/main/java/org/hibernate/tool/reveng/internal/export/java/EntityPOJOClass.java
              
                Fixed
          
            Show fixed
            Hide fixed
        
      554e870    to
    606af22      
    Compare
  
    …erge the relevant ant/gradle/maven plugins - Add the Reverse Engineering module
6080986    to
    1dfd0de      
    Compare
  
            
          
                tooling/hibernate-ant/src/main/java/org/hibernate/tool/ant/ConfigurationTask.java
              
                Fixed
          
            Show fixed
            Hide fixed
        
              
          
                tooling/hibernate-ant/src/main/java/org/hibernate/tool/ant/HibernateToolTask.java
              
                Fixed
          
            Show fixed
            Hide fixed
        
      | * @author max | ||
| * @author <a href='mailto:the_mindstorm@evolva.ro'>Alexandru Popescu</a> | ||
| */ | ||
| public class JDBCConfigurationTask extends ConfigurationTask { | 
Check failure
Code scanning / CodeQL
No clone method Error
| import java.io.File; | ||
| import java.util.Properties; | ||
| 
               | 
          ||
| public class JPAConfigurationTask extends ConfigurationTask { | 
Check failure
Code scanning / CodeQL
No clone method Error
| import java.util.List; | ||
| import java.util.Properties; | ||
| 
               | 
          ||
| public class JavaFormatterTask extends Task { | 
Check failure
Code scanning / CodeQL
No clone method
        
          
                tooling/hibernate-ant/src/main/java/org/hibernate/tool/hbm2ddl/hbm2ddl/SchemaUpdateTask.java
              
                Fixed
          
            Show fixed
            Hide fixed
        
              
          
                tooling/hibernate-ant/src/main/java/org/hibernate/tool/hbm2ddl/hbm2ddl/SchemaExportTask.java
              
                Fixed
          
            Show fixed
            Hide fixed
        
              
          
                tooling/hibernate-ant/src/main/java/org/hibernate/tool/hbm2ddl/hbm2ddl/SchemaExport.java
              
                Fixed
          
            Show fixed
            Hide fixed
        
      | templatePath = path; | ||
| } | ||
| 
               | 
          ||
| public void setTemplatePrefix(String s) { | 
Check notice
Code scanning / CodeQL
Useless parameter Note
        
          
                tooling/hibernate-ant/src/main/java/org/hibernate/tool/ant/ConfigurationTask.java
              
                Fixed
          
            Show fixed
            Hide fixed
        
      a0eb131    to
    0c719d0      
    Compare
  
    a3b2471    to
    86462b8      
    Compare
  
    …erge the relevant ant/gradle/maven plugins - Add the reveng Ant tasks Signed-off-by: Koen Aers <koen.aers@gmail.com>
86462b8    to
    596248e      
    Compare
  
    
[Please describe here what your change is about]
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.
https://hibernate.atlassian.net/browse/HHH-19879