Oil is used to extract pepper flavor, as piperine is relatively non-polar. Its solubility in water (a polar solvent) is only 0.04 grams per liter. It is more soluble in less polar solvents (67 grams per liter in alcohol, for example).
A related post:
How to infuse black layer of peppercorn into an oil?
Piperine has amide and benzodioxole functional groups, and would be chemically reactive, so it might lose flavor if heated too hot or too long.
A little chemical background on solubility: It all comes down to “like dissolves like”.
Atoms are made of bits with electrical charges, both positive and negative. These opposite charges attract each other, and hold atoms and chemical compounds together. Compounds are made from two or more (can be 100s or even more) atoms joined together. If the electrical charges are evenly distributed in a molecule, then its surface is neutral everywhere. That's “non-polar”. But some chemical compounds have the electrical charge unevenly distributed, so there are areas on the surface with + and - charge. That's “polar”. Some atoms or groups of atoms can also gain or lose charges to become ions. Ions are electrically charged by nature.
Water is very polar. The + and - charges on the surface are attracted to opposite charges on other water molecules, so it sticks to itself really well. This is why it has such a high boiling point for such a small molecule. Also, because it sticks using + and - charges, it can also dissolve compounds that have plenty of those surface +/- charges, like sugars, or ionic compounds like salt. But it's hard for anything that doesn't have those charges (non-polar molecules like piperine) to dissolve, because they would get in the way of the strong +/- attractions.
But piperine can mix with other non-polar or low-polarity molecules, like oil. When they mix with each other, there aren't very strong forces holding them together. It's mostly just the forces of disorder. And they aren't blocking electrically charged molecules from finding opposite charges to stick to.
Lots of molecules have both polar (electrically charged) parts and also non-polar (electrically neutral) parts. These can then dissolve/mix with both kinds of molecules (the best examples of these, like lecithin and other emulsifiers, can help fats and water stick together). Alcohol is one of these in-between molecules. It can dissolve the piperine, but also mix with water. It's also very volatile, so it could be used to efficiently dissolve out a molecule like piperine, and then be evaporated away to leave a more concentrated mixture, or even deposit the piperine into an oil in more concentrated form. Lately a lot of people are flavoring vodka with black pepper.