[jbosstools-issues] [JBoss JIRA] (JBIDE-11394) Generate persistence.xml and -ds.xml based on DTP Connection info
Pete Muir (JIRA)
jira-events at lists.jboss.org
Fri Jun 1 07:14:18 EDT 2012
[ https://issues.jboss.org/browse/JBIDE-11394?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12697985#comment-12697985 ]
Pete Muir commented on JBIDE-11394:
-----------------------------------
JPA/Hibernate will correctly default a lot of that for you. Remember also, that we follow convention over configuration, so we want to suggest a minimal good config, not present all options. We should also include comments for them. Here is the template I would suggest:
{code}
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="primary">
<!-- If you are running in a production environment, add a managed
data source, this example data source is just for development and testing! -->
<!-- The datasource is deployed as ${ds-deployment-location}, you
can find it in the source at ${ds-source-location} -->
<jta-data-source>${ds-name}</jta-data-source>
<properties>
<!-- Properties for Hibernate -->
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<!-- Print's out the SQL statement Hibernate is using to the console, useful for debugging -->
<property name="hibernate.show_sql" value="false" />
</properties>
</persistence-unit>
</persistence>
{code}
Specifically note that there are replacements in the comments, and that setting the persistence-unit name to the project name is not really necessary, as they are scoped to the deployment unit anyway and not used for anything much (unless you have >1, in which case the project name is not unique enough).
Also note that we don't really recommend using hbm2ddl in update mode, so we shouldn't generate that.
> Generate persistence.xml and -ds.xml based on DTP Connection info
> -----------------------------------------------------------------
>
> Key: JBIDE-11394
> URL: https://issues.jboss.org/browse/JBIDE-11394
> Project: Tools (JBoss Tools)
> Issue Type: Feature Request
> Components: common/jst/core, hibernate
> Environment: JBDS 5 Beta1
> Reporter: Pete Muir
> Assignee: Viacheslav Kabanovich
> Priority: Minor
> Fix For: 3.4.0.M1
>
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jbosstools-issues
mailing list