[jbosstools-issues] [JBoss JIRA] Commented: (JBIDE-2077) "Make this class and its related classes mapped via JPA"

Max Rydahl Andersen (JIRA) jira-events at lists.jboss.org
Fri Aug 29 17:59:38 EDT 2008


    [ https://jira.jboss.org/jira/browse/JBIDE-2077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12427416#action_12427416 ] 

Max Rydahl Andersen commented on JBIDE-2077:
--------------------------------------------

1) Vitaly, please do *not* pollute the context menu! This should be a refactoring! And how does this work for multiple classes which is what would be interesting to do.

2) 
java.io.Serializable is not a requirement.
If no constructors then there is a default constructor thus that is not relevant to generate. should only add that if there are no no-argument constructor - and should probably be protected if there arent any so we dont expose more than the user had before.

3)  Why add @Column ? the column name can be automatically be deduced from the propertyname

4) How would you detect Transient properties?

5) If abstract @MappedSuperClass might be relevant ? (not needed in first run and I would say we should not touch those files. Just show warning to user if there are such.

6) You cant have abstract methods without it being an abstract class - see 5

7) Looks good as a start.

8) No (unless the property named id is a non-primitive class 

9) yes!

10) wouldnt the default be ok?

11) 
 a) future enhancements, not sure what you can find in the db that wont be in the model?
 b) sure

12) see 1

Waiting for the patch ;)





> "Make this class and its related classes mapped via JPA"
> --------------------------------------------------------
>
>                 Key: JBIDE-2077
>                 URL: https://jira.jboss.org/jira/browse/JBIDE-2077
>             Project: Tools (JBoss Tools)
>          Issue Type: Feature Request
>          Components: Hibernate
>            Reporter: Vitali Yemialyanchyk
>            Assignee: Vitali Yemialyanchyk
>            Priority: Minor
>             Fix For: 3.0.0.beta1
>
>
> Denis Golovin:
> >>>
> Let's imagine I have several (say 10) classes that I'd like to make
> persistent. The classes form completed domain model.
> I decided to use hibernate and JPA annotations, I have lets say JBDS
> 1.1.0 or JBossTools 2.1.0 installed.
> Question is what I should do to make my model persistent? It there
> anything that helps me to do it?
> Now I see only way. I have to go through all classes and add annotations
> for class and for fields.
> >>>
> Max Andersen:
> >>>
> Having a "Make this class and its related classes mapped via JPA" would be 
> an interesting Refactoring to implement.
> Should basically just work like this:
> makePersistent(ITypeRoot clazz, Set processed) {
>   add @Entity 
>   Find most likely id property and add @Id  
>  processed.add(selectedClass);
>  associations = getAssociatedClasses(selectedClass);
>  foreach class in associations {
>   if(!processed.contains(class)) {
>        makePersistent(class, processed);     
>   }  
> }
> }
> There then might be some exceptional cases like handling version properties, temporal values and
> non-JPA supported mappings which Hibernate would be able to understand/map.
> >>>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jbosstools-issues mailing list