persistence@glassfish.java.net

Re: Question about ddl files that are created

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Mon, 05 Dec 2005 15:20:42 -0800

Peter,

I think we are currently arguing about the right
way to make the change. Pramod had sent you the
solution for review a week ago.

Regards,
-marina

Peter Krogh wrote On 12/05/05 13:25,:
> I believe that Pramod is currently looking at providing a solution for review...
>
>
>
> -----Original Message-----
> From: Sanjeeb.Sahoo_at_Sun.COM [mailto:Sanjeeb.Sahoo_at_Sun.COM]On Behalf Of
> Sanjeeb Kumar Sahoo
> Sent: Monday, December 05, 2005 4:13 PM
> To: Peter Krogh
> Cc: Marina Vatkina; Pramod Gopinath; king.wang_at_oracle.com;
> ejb3-toplink-ext_at_Sun.COM; Robert Campbell;
> persistence_at_glassfish.dev.java.net
> Subject: Re: Question about ddl files that are created
>
>
> Hi Peter,
>
> Thanks for responding.
> I am not after how the bug should be fixed. I leave it to experts to
> decide. I am only suggesting that the sooner we add this feature, the
> better it is for the RI (container as well as provider). This is just a
> catchy feature and lot of developers are after it. We have a promoted
> build happening this Wed'day, which means we have another day to put it
> a fix. Is it possible to resolve this issue by then?
>
> Thanks,
> Sahoo
>
> Peter Krogh wrote:
>
>
>>Sahoo,
>>
>>Sorry I missed the question in there.
>>
>>There are two issues. I am attempting to solve both. Here is what I understand:
>>
>>a) Different platforms require different tokens for execution of SQL. Historically that is called the storedProcedureToken in TopLink.
>>
>>b) The DDL generator can not use this and always requires a "".
>>
>>My solution solves this, it also allows user of TopLink to not notice the change. Where it breaks down, is if the DDL generation ever required the use of anything other than a "". If so, I think that it is completely valid to add another tag that is used by the generator. However it needs to be done in a way that will not break existing TopLink customers.
>>
>>-----Original Message-----
>>From: Sanjeeb.Sahoo_at_Sun.COM [mailto:Sanjeeb.Sahoo_at_Sun.COM]On Behalf Of
>>Sanjeeb Kumar Sahoo
>>Sent: Monday, December 05, 2005 3:36 PM
>>To: Peter Krogh
>>Cc: Marina Vatkina; Pramod Gopinath; king.wang_at_oracle.com;
>>ejb3-toplink-ext_at_sun.com; Robert Campbell;
>>persistence_at_glassfish.dev.java.net
>>Subject: Re: Question about ddl files that are created
>>
>>
>>Hi Peter,
>>
>>Can we have a resolution to this issue soon? I don't think we disagree
>>the importance of this feature in a provider in development environment
>>which is what we have right now for Java EE 5. Last week while
>>demonstrating an example that uses Java EE 5/EJB 3.0 reference
>>implementation in FOSS.IN (a open source summit held in Bangalore),
>>quite a good number of users expressed their interest for this feature
>>and they want full support this soon.
>>
>>So can we at least get this stuff working using what ever is easy to
>>implement now and then change it later on to whatever is agreed to be
>>the best solution?
>>
>>Thanks,
>>Sahoo
>>
>>Marina Vatkina wrote:
>>
>>
>>
>>
>>>OK. I'm totally confused.
>>>
>>>(Should we have a phone conf on this?)
>>>
>>>My understanding of the issue is (please correct me if and where I'm
>>>wrong):
>>>The current code appends a token (StoredProcedureTerminationToken) to
>>>each
>>>sql statement written to a file for all dbs other than Oracle.
>>>
>>>This means (problem #1) that we can't execute such statements via JDBC
>>>calls
>>>at deployment time *for all dbs other than Oracle".
>>>
>>>It also means that if we try to give these files to a user (something
>>>that we are
>>>interested in doing), it won't work for Oracle, as the corresponding
>>>file won't
>>>have ';' at the end of the statements.
>>>
>>>There is a (distant) possibility that a particular database was set up
>>>to use an
>>>unusual token (e.g. "#") as the delimiter. Which means (problem
>>>#2) that it's
>>>a good idea to support this option by accepting an extra property that
>>>allows
>>>you to override the default value.
>>>
>>>And here is my confusion: it looks to me that we are trying to solve
>>>problem #1
>>>by a solution for problem #2.
>>>Isn't bypassing the token add step is all that we need for the mode of
>>>generating
>>>files for a JDBC consumption?
>>>
>>>thanks,
>>>-marina
>>>
>>>Peter Krogh wrote:
>>>
>>>
>>>
>>>
>>>>I think that we agree, but I want to make sure...With the slight
>>>>changes that I suggested, all platforms will work the same as they
>>>>currently do now. When you call
>>>>setStoredProcedureTerminationToken(TOKEN); on the platform, you are
>>>>changing the token to be something else for that instance of
>>>>platform.This way the changes would be transparent to the current
>>>>user of TopLink. To me this sounds like a fairly elegant solution,
>>>>that maintains backward compatibility, and doesn't require two code
>>>>paths.If you are good with this, I think that this should be fine. Peter
>>>>
>>>> -----Original Message-----
>>>> *From:* Pramod Gopinath [mailto:pramod.gopinath_at_sun.com]
>>>> *Sent:* Thursday, December 01, 2005 3:26 PM
>>>> *To:* Peter Krogh
>>>> *Cc:* king.wang_at_oracle.com; ejb3-toplink-ext_at_sun.com; Robert
>>>> Campbell
>>>> *Subject:* Re: Question about ddl files that are created
>>>>
>>>> Hi Peter
>>>> Let me start by restating the problem :
>>>> In the java2db mode/scenario I do not want the termination tokens
>>>> printed out after each ddl statement in the file. The methods
>>>> SchemaManager.createObject() and SchemaManager.dropObject() are
>>>> the ones that right out this termination tokens. The same code
>>>> path would be used by the pure toplink code as well as from
>>>> within the glassfish code. In the pure toplink case the code
>>>> should still print out the termination tokens as it has been
>>>> doing until now.
>>>> Currently toplink code is writing out a sql ddl file and what we
>>>> need in the java2db case is a jdbc ddl file.
>>>>
>>>>
>>>> Using the code changes that U have provided the changes would be
>>>> In EntityManagerFactoryProvider.generateDDLFiles(...) {
>>>>
>>>> //new line to be introduced
>>>> */_mgr.getSession().getPlatform().setStoredProcedureTerminationToken("");_/*
>>>>
>>>>
>>>> if(shouldDropFirst)
>>>> mgr.replaceDefaultTables();
>>>> else
>>>> mgr.createDefaultTables();
>>>> }
>>>> }
>>>>
>>>> So now we do not need to make any changes to SchemaManager.java.
>>>> If this changes are ok, I can make these changes, test them and
>>>> send them out for review.
>>>>
>>>> Thanks
>>>> Pramod
>>>>
>>>>
>>>> Peter Krogh wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>Pramod,
>>>>>
>>>>>The solution that you described is similar to my first thought. However I think that there may be a simpler solution that is more flexible. It involves making the token settable. DatabasePlatform would changed to be something like this:
>>>>>
>>>>>DatbasePlatform
>>>>> String storedProcedureTerminationToken = null;
>>>>> String defaultStoredProcedureToken = ";"; {this is set differently per subclass};
>>>>> ...
>>>>> ...
>>>>>
>>>>> public String getStoredProcedureTerminationToken() {
>>>>> return (storedProcedureTerminationToken == null) ? defaultStoredProcedureToken : storedProcedureTerminationToken;
>>>>> }
>>>>>
>>>>> ...
>>>>> ...
>>>>> public void setStoredProcedureTerminationToken(String token) {
>>>>> storedProcedureTerminationToken = token;
>>>>> }
>>>>>
>>>>>Then your code would set your platform to use ";".
>>>>>
>>>>>What do you think?
>>>>>
>>>>>
>>>>>
>>>>>
>>
>>
>>
>