Question: I have a project with multiple modules say "Application A" and "Application B" modules (these are separate module with its own pom file but are not related to each other).

In the dev cycle, each of these modules have its own feature branch. Say,

```
 Application A --- Master
                  \
                   - Feature 1

 Application B --- Master
                  \
                   - Feature 1

```

Say Application A is independent and has its own release cycle/version.

Application B uses Application A as a jar. And is defined in its pom dependency.

Now, both teams are working on a feature branch say "Feature 1". What is the best way to setup Jenkins build such that, Build job for Application B is able to use the latest jar from "Feature 1" branch of Application A. 

Given Feature 1 is not allowed to deploy its artifacts to maven repository.

Somehow I want the jar from Application A's Feature 1 branch to be supplied as the correct dependency for Application B?

Answer: 
You can do this with a before update trigger. You would use such a trigger to assign the value of `offer_nr` based on the historical values. The key code would be:

```
new.offer_nr = (select coalesce(1+max(offer_nr), 1)
                from offers o
                where o.company_id = new.company_id
               )

```

You might also want to have `before update` and `after delete` triggers, if you want to keep the values in order.

Another alternative is to assign the values when you query. You would generally do this using a variable to hold and increment the count.
Don't make it this way. 

Have autoincremented company ids as well as independent order ids.  

That's how it works.

There is no such thing like "number" in database. Numbers appears only at the time of select.