Menu

#52 Apache Cayenne mapping files

open
nobody
None
5
2018-11-12
2018-11-09
No

My quest came to a new level.
Instead of sniffing random requests and feeding them to SQL Analyzer I stumbled upon
Apache Cayenne query definitions.
About 10K queries defined.

I hope those would pretty much cover my undocumented database and give me lots of links.

Currently I'm hacking away at somehow cut the chunk away.

Not sure if anybody in the world else would need this.
But it would be definitely one more source of wisdom.

Discussion

  • Alexander Petrossian (PAF)

    If important, there are various versions around, mine is 2.0

     
  • Alexander Petrossian (PAF)

    Also Cayenne can have relations explicitly defined.
    Not my case ;) Authors of these mappings didn't believe in making my life easier.

     
  • Alexander Petrossian (PAF)

    Ideally take a lib that eats this stuff and apply it to extract queries for specified dialect.
    (mapping files contain <sql>statement</sql> for various RDBMs-es)

    I feel Apache Cayenne itself is such a lib and should parse its own mappings without any hitch.

    Trouble is... inside statements there can be some quirks.

    Example:

    select c.ContractID as "ContractID",
                         i.InterfaceObjectID             as "InterfaceObjectID"
                  from tContract c WITH (NOLOCK INDEX=XPKtContract)
                  inner join tContractCredit cc WITH (NOLOCK INDEX=XPKtContractCredit) on cc.ContractCreditID = c.ContractID
                  inner join tConsInstrumentSync i WITH (NOLOCK INDEX=XPKtConsInstrumentSync) on i.InstrumentID = c.InstrumentID
            #chain('and' 'where')
                #chunk($LoanID) c.ContractID = #bind($LoanID) #end
                #chunk($IDList) c.ContractID in (#bind($IDList)) #end
            #end
    

    Everything is pretty obvious,
    But if there is already a lib that can handle that... maybe it's not very hard to utilize it instead of trying to repeat it logic..

     
  • Alexander Petrossian (PAF)

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB