]
Vitali Yemialyanchyk commented on JBIDE-4918:
---------------------------------------------
just about 4 - the empty cfg.xml is valid.
HIbernate Configuration File (cfg.xml) New Wizard should validate
file name on first step
-----------------------------------------------------------------------------------------
Key: JBIDE-4918
URL:
https://jira.jboss.org/jira/browse/JBIDE-4918
Project: Tools (JBoss Tools)
Issue Type: Bug
Components: Hibernate
Affects Versions: 3.1.0.M4
Reporter: Denis Golovin
Assignee: Dmitry Geraskov
Fix For: LATER
Several notes about hibernate.cfg.xml from Hibermate documentation:
1. hibernate runtime looking for configuration file 'hibernate.cfg.xml' in root
of class path, so user place 'hibernate.cfg.xml' to 'default package' i.e.
into source folder it will in case of
SessionFactory sf = new Configuration().configure().buildSessionFactory();
additional info is here
(
http://docs.jboss.org/hibernate/stable/core/reference/en/html/session-con...)
2. Hibernate configuration file can have any name and placed anywhere in CLASSPATH. In
this case it can be loaded by code
SessionFactory sf = new
Configuration().configure(${path-to-file-in-classpath}).buildSessionFactory();
Considering that, withatd should:
1. Provide default values based on current selection in Package Explorer
- if package or source folder is selected in Package explorer wizard should have the
same selection in wizard
- if any other folder outside source folder is selected in Package Explorer, wizard
should select first source folder available in project
2. Now validation of selected file name take place on second step, that should be done on
first one.
3. Validation should be not so strict but more informative:
- File extension must be .xml (error) - File extension should be .xml
- If location for file is not within src folder (warning) - Configuration placed
outside CLASSPATH will not be available at run-time
- If location is src root and file name is 'hibernate.cfg.xml' (no errors or
warnings) - This wizard allows you to create a configuration for Hibernate Console
- If location is src root and file name is not 'hibernate.cfg.xml' (warning) -
To load Configuration from '${filename}' you'll have to pass file name to
Configuration.configure() method
- If location is within src root but not src root and file name is not
'hibernate.cfg.xml' (warning) - To load Configuration from '${filename}'
you'll have to provide path file to Configuration.configure() method (not sure if that
true)
(Messages need to be discussed)
4. Second Step validation should warn that DB Dialect, DB Driver Class and URL should be
entered
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: