Antonio Goncalves created FORGE-2417:
----------------------------------------
Summary: Being able to add a datasource definition
Key: FORGE-2417
URL:
https://issues.jboss.org/browse/FORGE-2417
Project: Forge
Issue Type: Sub-task
Components: Java EE
Affects Versions: 2.17.0.Final
Reporter: Antonio Goncalves
Fix For: 2.x Future
It would be good to have a command to quickly add a new {{DatasourceDefinition}} :
{code}
jpa-add-datasource-definition --named java:global/MyApp/myDS --className
org.apache.derby.jdbc.ClientDataSource --port 1527 --server localhost -dbName testDB
--user scott --password tiger
{code}
This will create a new class called {{org.myproject.DatasourceResources}} if it
doesn't exist, and will add a new {{DatasourceDefinition}} :
{code}
package org.myproject;
@DatasourceDefinitions({
@DatasourceDefinition(
name = "java:global/MyApp/myDS",
className = "org.apache.derby.jdbc.ClientDataSource",
portNumber = 1527,
serverName = "localhost",
databaseName = "testDB",
user = "lance",
password = "secret"
)
})
public class DatasourceResources {
}
{code}
Tying the command a second time will add a new {{DatasourceDefinition}} to the exiting
{{DatasourceDefinitions}} :
{code}
package org.myproject;
package org.myproject;
@DatasourceDefinitions({
@DatasourceDefinition(
name = "java:global/MyApp/myDS",
className = "org.apache.derby.jdbc.ClientDataSource",
portNumber = 1527,
serverName = "localhost",
databaseName = "testDB",
user = "lance",
password = "secret"
),
@DatasourceDefinition(
...
)
})
public class DatasourceResources {
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)